------- Comment #6 from jason at gcc dot gnu dot org 2009-11-08 23:24 ------- 14.7.4.1 [temp.point] says:
...the point of instantiation for such a specialization immediately follows the namespace scope declaration or definition that refers to the specialization. So, the point of instantiation for B<int>::B(), and thus for B<int>::a, is *after* the declaration of b, and therefore there's no reason to expect B<int>::a to be initialized before b. If you need B<int>::a to be initialized before b, you can provide an explicit instantiation: template A B<int>::a; B<int> b; -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17910