This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: template static member instantiation


mec.gnu@mindspring.com (Michael Elizabeth Chastain) writes:

[...]

| Looking at Stroustroup, C++PL, 3rd edition, section C.13.1 says: "Static
| members must be separately defined and can be specialized." Section
| C.13.10 says: "When a class template is explicitly instantiated, every
| member function is also instantiated".  That kind of implies that the
| test program needs an explicit instantiation for each my_static.  But
| I'd like to get an expert opinion.

14.7.2/7

  The explicit instantiation of a class template specialization
  implies the instantiation of all of its members not previously
  explicitly specialized in the translation unit containing the
  explicit instantiation. 

That includes static data members too.

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]