Instantiating a static data member of a class template

Matt Austern austern@apple.com
Thu May 22 22:05:00 GMT 2003


gcc 3.3 accepts this code, and mainline rejects it:
     template <class C>
     class A {
         static int i;
     };

     int A<int>::i = 1;

Looking through clause 14 of the C++ standard, I believe that mainline 
is right and 3.3 is wrong.  I may be confused, but it looks to me as if 
the definition of A<int>::i isn't legal: I don't think it satisfies the 
definition of an implicit instantiation, an explicit instantiation, an 
explicit specialization, or anything else.

Do other people agree that mainline's behavior is correct?

			--Matt



More information about the Gcc mailing list