Ignoring the specific error message the core issue is that you are trying to initialize a static member attribute in the declaration while in general that should be done in the definition.
// header
struct test {
static std::string x;
};
// single cpp
std::string test::x = "foo";
Now back to the error messages. There is an exception in the C++03 standard that allows to provide an initializer to the declaration of a constant integral type, so that the value can be visible in all translation units that include the header and can thus be used as a constant expression:
// header
struct test {
static const int size = 10;
};
// some translation unit can do
struct A {
int array[test::size];
};
If the value was defined in the definition of the variable, then the compiler could only use it in that single translation unit. It seems that your compiler is doing two tests, one for const-ness and a separate one for the integral part and thus two error messages.
Another thing that might affected that design in the compiler is that the C++11 standard allows for initializers in the declaration of non-static members of a class, which will then be used in the initializer list of each constructor that does not provide a value for that field:
struct test {
int a = 10;
int b = 5;
test() : a(5) // b(5) implicitly generated
{}
};
This is unrelated to your particular issue, as your member is static but it probably explains why the tests in the compiler were split as they are.