This is the mail archive of the gcc-bugs@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: c++/10112: static data member is not correctly initialized


"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


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