Clang/LLVM 6.0.0 does not ask for a definition of a static data member declaration. See the following little program:
// main.cpp
#include <iostream>
struct A
{
void f()
{
std::cout << "bla";
}
};
struct S
{
static A a; // declaration, not definition
};
int main()
{
S::a.f();
}
This code compiles successfully (with -Xclang -std=c++17 -Xclang -flto -Xclang -O3) and outputs "bla". But there is no definition of S::a.
In contrast MSVC does not compile and complains about the unresolved external symbol S::a.
Now this is a bug in Clang/LLVM, right?