Linkage of the following example reports an undefined reference to `A::anInt'. ---- example.cpp struct A { template<typename T> void operator%( T const & object ) {} static int const anInt = 5; }; int main( void ) { A() % A::anInt; return 0; }
Indeed, in general you have to add: const int A::anInt; At high optimization levels the the static int is "inlined" but this is just implementation defined behavior...