According to Compiler Explorer, only some will build this code:
struct s { static int i; };
int main( int argc, char *argv[] )
{
s::i = 1;
return 0;
}
Most newer C++ compilers fail at linking.
- GCC 4.7.2 works, 4.7.3 and newer fail
- Clang 3.2 works, 3.4 and newer fail
- msvc works with all versions
So, is this undefined behaviour or should this work?