My Test class has a const static member of a subtype. I usually define this const static member as follows.
class Test
{
public:
class Dummy {};
private:
static Dummy const dummy;
};
Test::Dummy const Test::dummy; // ERROR HERE
int main()
{
return 0;
}
When compiling this source with gcc-4.6, it gives no error and compiles correctly.
When compiling this same source with gcc-4.4, it gives the following error:
error: uninitialized const ‘Test::dummy’
on the marked line.
- Is there another way to define this static const member variable?
- Is this a limitation of gcc-4.4?
- Is there a workaround?
Say: