This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: template static member instantiation
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: mec dot gnu at mindspring dot com (Michael Elizabeth Chastain)
- Cc: gcc at gcc dot gnu dot org, carlton at kealia dot com
- Date: 28 May 2004 14:43:05 +0200
- Subject: Re: template static member instantiation
- Organization: Integrable Solutions
- References: <20040528134701.EB3B84B104@berman.michael-chastain.com>
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