main.cpp:
class A
{
public:
static const int x = 1;
};
int main()
{
auto p = &A::x;
}
Compilation command line:
clang++ -std=c++20 -pedantic-errors main.cpp -o prog
Output:
/usr/bin/ld: /tmp/main-008420.o: in function `main':
main.cpp:(.text+0x8): undefined reference to `A::x'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Why do I get that linker error? What part of the c++ standard forbids me to do this?