July 15, 2004 [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?
|
July 16, 2004 Re: [bug report] sizeof in template default argument | ||||
---|---|---|---|---|
| ||||
Posted in reply to Christof Meerwald | /* 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? |
Copyright © 1999-2021 by the D Language Foundation