c++ - [bug report] sizeof in template default argument
- Christof Meerwald (15/15) Jul 15 2004 template< class T, int n = sizeof( T ) >
- Anuj Goyal (19/34) Jul 15 2004 /* reverse some code => internal error */
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