This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-12-20
[Moved to DR at the February, 2014 meeting.]
According to 7.3.2 [conv.lval] paragraph 2,
if the glvalue has a class type, the [lvalue-to-rvalue] conversioncopy-initializes a temporary of typeT from the glvalue and theresult of the conversion is a prvalue for the temporary.
The implications of such a conversion for odr-use do not appear to havebeen factored into 6.3 [basic.def.odr] paragraph 3, which exemptsconstant objects that are immediately lvalue-to-rvalue converted. Forexample, given
struct S { int n; }; struct T { static constexpr S s = {}; }; void f(...); void g() { f(T::s); }Does this odr-useT::s, requiring it to have a definition,because of binding it to the reference parameter ofS'scopy constructor? How about
struct S { int n; }; void f(...); void g() { constexpr S s = {}; [] { f(s); }; }Doess need to be captured? There is implementation varianceon both these examples.
Proposed resolution (September, 2013):
Change 6.3 [basic.def.odr] paragraph 3 as follows:
A variablex whose name appears as a potentially-evaluatedexpressionex isodr-used unlessx satisfiesthe requirements for appearing in a constant expression(7.7 [expr.const])applying the lvalue-to-rvalueconversion (7.3.2 [conv.lval]) tox yields a constantexpression (7.7 [expr.const]) that does not invoke any non-trivialfunctions and, ifx is an object,ex is an elementof the set of potential results of an expressione, where eitherthe lvalue-to-rvalue conversion (7.3.2 [conv.lval]) is appliedtoe, ore is a discarded-value expression (Clause 7 [expr]).this is odr-used...