Thread overview |
---|
September 10, 2003 statics still break in 8.36 | ||||
---|---|---|---|---|
| ||||
Simplified source is here from CppUnit 1.8.0 class ClassType{ ClassType(int name){} }; int Name(){ return 0; } #define CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(suiteName ) \ static ClassType __autoRegisterSuite(suiteName) CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(coreSuiteName()); --------------------------------------------------------------------- this also break: ClassType some(coreSuiteName()); Those were legal in vc6 and bcc55 |
September 10, 2003 Re: statics still break in 8.36 | ||||
---|---|---|---|---|
| ||||
Posted in reply to nyra | Ok, but there are some errors in the code you posted, and I can't figure out just what you meant. For example, what is Name() for? where's the definition of coreSuiteName()? "nyra" <nyra@sohu.com> wrote in message news:bjn97v$24p3$1@digitaldaemon.com... > Simplified source is here from CppUnit 1.8.0 > > class ClassType{ > ClassType(int name){} > }; > > int Name(){ > return 0; > } > > #define CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(suiteName ) \ > static ClassType __autoRegisterSuite(suiteName) > > > CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(coreSuiteName()); > > --------------------------------------------------------------------- > this also break: > > ClassType some(coreSuiteName()); > > Those were legal in vc6 and bcc55 > > > > > > > > > |
September 11, 2003 Re: statics still break in 8.36 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | sorry for my careless ! but forget that the function coreSuiteName() really is Name(). this problem is about template explicit instantiation and static variable ---------------------------------------------- template <class T> class ClassType{ ClassType(int name){} }; int Name(){ return 0; } static ClassType<int> some(Name()); //error-occured ---------------------------------------------- it seems ClassType<int> is not instanted before static variable some defined! compiler can't find the constructor of ClassType<int>(int name). but when I use non-static defination, everything goes well. ClassType<int> some(Name()); especially, if I put a non-static defination (or explicit template instance )before static one, it compiled! ClassType<int> some1(Name()); static ClassType<int> some2(Name()); OR template ClassType<int>; static ClassType<int> some(Name()); expecting this fixed......... Sorry for my last letter again! |
Copyright © 1999-2021 by the D Language Foundation