In most cases, each member of a class template is created only if this particular element is used. Since your code never uses member AAA<int>::b , this element is not created.
Adding a no-operation b; operator b; in AAA<T>::AAA() or AAA<T>::~AAA() or AAA<T>::foo() calls the static object AAA<int>::b , which will be constructed and destroyed as you expected.
Or, if you want to tell the compiler to implement all instances of a specific specialization of a particular class, use explicit instantiation (in the source file, not in the header):
template class AAA<int>;
source share