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 report] sizeof in template default argument
template< class T, int n = sizeof( T ) > // Error: size of T is not known struct A { static const int val = n; }; int main() { A<int> a; return 0; } bye, Christof -- http://cmeerw.org JID: cmeerw jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net? Jul 15 2004
/* reverse some code => internal error */ struct A { static const int val = n; }; template< class T, int n = sizeof( T ) > int main() { A<int> a; return 0; } /* output */ C:\workdmc>dmc -WA template.cpp struct A { static const int val = n; }; ^ template.cpp(1) : Error: undefined identifier 'n' template< class T, int n = sizeof( T ) > ^ template.cpp(2) : Error: size of T is not known Internal error: template 1865 --- errorlevel 1 In article <cd6sef$2enl$3 digitaldaemon.com>, Christof Meerwald says...template< class T, int n = sizeof( T ) > // Error: size of T is not known struct A { static const int val = n; }; int main() { A<int> a; return 0; } bye, Christof -- http://cmeerw.org JID: cmeerw jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net? Jul 15 2004
|