Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++ - [bug] partial ordering of templates
DMC 8.42.5 compiles the following program without any errors, but the template instantiation really should be ambiguous: template<int n, int m> struct D { static const int val = 0; }; template<int n> struct D<n, n> { static const int val = 1; }; template<int n> struct D<1, n> { static const int val = 2; }; int main() { return D<1, 1>::val; } bye, Christof -- http://cmeerw.org mailto:cmeerw at web.de xmpp:cmeerw at cmeerw.org ...and what have you contributed to the Net? Mar 28 2005
I don't think it should be ambiguous. Both D<n,n> and D<1,n> match, and the partial specialization rules say that the one that is most specialized wins. D<1,n> is most specialized. Apr 20 2005
Walter wrote:I don't think it should be ambiguous. Both D<n,n> and D<1,n> match, and the partial specialization rules say that the one that is most specialized wins. D<1,n> is most specialized. Apr 20 2005
"Christof Meerwald" <cmeerw web.de> wrote in message news:d45go5$31b3$1 digitaldaemon.com...Walter wrote:I don't think it should be ambiguous. Both D<n,n> and D<1,n> match, and Apr 20 2005
Walter wrote:Darn it, I think you're right <g>. Apr 24 2005
|