This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/10112: static data member is not correctly initialized
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: "Giovanni Bajo" <giovannibajo at libero dot it>
- Cc: "Wolfgang Bangerth" <bangerth at ticam dot utexas dot edu>, <gcc-gnats at gcc dot gnu dot org>, <gcc-bugs at gcc dot gnu dot org>, <o dot kullmann at swansea dot ac dot uk>, <nathan at gcc dot gnu dot org>
- Date: 18 Mar 2003 02:46:40 +0100
- Subject: Re: c++/10112: static data member is not correctly initialized
- Organization: Integrable Solutions
- References: <Pine.LNX.4.44.0303171812020.26889-100000@gandalf.ticam.utexas.edu><022601c2ecee$dc710080$044c2a97@bagio>
"Giovanni Bajo" <giovannibajo at libero dot it> writes:
[...]
| Nathan, I agree that the order of instantiation is implementation defined,
| but the initialization of the static data members should happen before any
| template is instantiated.
>From which parts of the standard did read that?
| §14.7.1p8 decouples initialization of static data
| members and instantiation of class templates, saying that <<implicit
| instantiation of a class template does not cause any static data members of
| that class to be implicitly instantiated>>. In fact, <<static data members
| are initialized [...] exactly like nonlocal objects>> (§9.4.2p7), <<before
| any other initialization takes place>> (§3.6.2p1) (and of course only if
| <<the static data member is itself used in a way that requires the
| definition of the static data member to exist>> (§14.7.1p1).
I can't read that to imply the your first assertion quoted above.
-- Gaby