Title
Initialization order of thread_local template static data members
Status
open
Section
6.9.3.2 [basic.start.static]
Submitter
Richard Smith

Created on 2013-04-14.00:00:00 last changed 141 months ago

Messages

Date: 2022-09-25.18:08:42

According to 6.9.3.2 [basic.start.static] paragraph 5,

It is implementation-defined whether the dynamic initialization of a non-local variable with static or thread storage duration is done before the first statement of the initial function of the thread. If the initialization is deferred to some point in time after the first statement of the initial function of the thread, it shall occur before the first odr-use (6.3 [basic.def.odr]) of any variable with thread storage duration defined in the same translation unit as the variable to be initialized.

This doesn't consider that initialization of instantiations of static data members of class templates (which can be thread_local) are unordered. Presumably odr-use of such a static data member should not trigger the initialization of any thread_local variable other than that one?

History
Date User Action Args
2013-04-14 00:00:00admincreate