This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-11-11
The concept of odr-use is a static program property, independent of runtime control flow. For example,
void f() {
if (false)
g(); // unconditionally odr-uses g
}
Yet, some parts of the standard talk about an odr-use participating in the happens-before relation, which is a category error.
Proposed resolution [SUPERSEDED]:
Change in 6.3 [basic.def.odr] paragraph 6 through 8 as follows:
A structured binding is odr-used
if it appears asby a potentially-evaluated expression E if it is named by E.*this is odr-used if this appears as a potentially-evaluated expression (including as the result of the implicit transformation in the body of a non-static member function (11.4.3 [class.mfct.non.static])).
A virtual member function is odr-used if it is not pure. A function is odr-used by
if it is named bya potentially-evaluated expression or conversion E if it is named by E. A non-placement allocation or deallocation function for a class is odr-used by the definition of a constructor of that class. A non-placement deallocation function for a class is odr-used by the definition of the destructor of that class, or by being selected by the lookup at the point of definition of a virtual destructor (11.4.7 [class.dtor]). [ Footnote: ... ]
Change in 6.9.3.3 [basic.start.dynamic] paragraph 4 as follows:
A non-initialization odr-use of an entity is the evaluation of an expression that odr-usesan odr-use(6.3 [basic.def.odr]) the entity where the evaluation is not caused directly or indirectly by the initialization of a non-block static or thread storage duration variable.
CWG 2024-01-19
Since "odr-use" is a category error here, use the term "non-initialization use" instead.
Possible resolution:
Change in 6.3 [basic.def.odr] paragraph 6 through 8 as follows:
A structured binding is odr-used
if it appears asby a potentially-evaluated expression E if it is named by E.*this is odr-used if this appears as a potentially-evaluated expression (including as the result of the implicit transformation in the body of a non-static member function (11.4.3 [class.mfct.non.static])).
A virtual member function is odr-used if it is not pure. A function is odr-used by
if it is named bya potentially-evaluated expression or conversion E if it is named by E. A non-placement allocation or deallocation function for a class is odr-used by the definition of a constructor of that class. A non-placement deallocation function for a class is odr-used by the definition of the destructor of that class, or by being selected by the lookup at the point of definition of a virtual destructor (11.4.7 [class.dtor]). [ Footnote: ... ]
Change in 6.9.3.3 [basic.start.dynamic] paragraph 4 through 7 as follows:
A non-initialization
odr-useuse of an entity is the evaluation of an expression that odr-usesan odr-use(6.3 [basic.def.odr]) the entity where the evaluation is not caused directly or indirectly by the initialization of a non-block static or thread storage duration variable....If it is deferred, it strongly happens before any non-initialization
odr-useuse of any non-inline function or non-inline variable defined in the same translation unit as the variable to be initialized. [ Footnote: ... ] ... [ Example: ... It is implementation-defined whether either a or b is initialized before main is entered or whether the initializations are delayed until a is firstodr-usedused in main. In particular, if a is initialized before main is entered, it is not guaranteed that b will be initialized before it isodr-usedused by the initialization of a, that is, before A::A is called. If, however, a is initialized at some point after the first statement of main, b will be initialized prior to its use in A::A. -- end example ]... If it is deferred, it strongly happens before any non-initialization
odr-useuse of that variable. ...... If it is deferred, the initialization associated with the entity for thread t is sequenced before the first non-initialization
odr-useuse by t of any non-inline variable with thread storage duration ...