https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69387

--- Comment #2 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
Do you mean that is invalid?

class StatusCode
{
public:
  static const int TEST_VALUE = 0x2;
};


I thought it is like defining
const int XXX = 123; which is actually only
a #define not a linker symbol.

I found that syntax in production code,
and it seems to be working everywhere, only
in the template context not, but it is working
other compilers.

We can write this declaration in the .h file

class StatusCode
{
public:
  static const int TEST_VALUE;
};

and have this definition somewhere:
const int StatusCode::TEST_VALUE=2;

that works, but it means something completely different.
The value will be an extern const int in that case.

like

extern const int TEST_VALUE; // in .h file

and

extern const int TEST_VALUE=0x2; // at one place

Reply via email to