Created on2015-09-02.00:00:00 last changed62 months ago
Proposed resolution (January, 2019):
This issue is resolved by the resolution ofissue 2083.
[Accepted as a DR at the February, 2019 meeting.]
The current definition of odr-use of a variable is problematicwhen applied to an array:
A variablex whose name appears as apotentially-evaluated expressionex is odr-usedbyex unless applying the lvalue-to-rvalueconversion (7.3.2 [conv.lval]) tox yields aconstant expression (7.7 [expr.const]) that doesnot invoke any non-trivial functions and, ifx isan object,ex is an element of the set of potentialresults of an expressione, where either thelvalue-to-rvalue conversion (7.3.2 [conv.lval]) isapplied toe, ore is a discarded-valueexpression (Clause 7 [expr]).
Consider an example like
struct S { constexpr static const int arr[3] = { 0, 1, 2 }; }; int i = S::arr[1]; // Should not requireS::arr to be definedAlthough the “set of potential results” testcorrectly handles the subscripting operation (since theresolution ofissue 1926), itrequires applying the lvalue-to-rvalue conversion toS::arr itself and not just to the result of thesubscripting operation. Class objects exhibit a similarproblem.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2020-12-15 00:00:00 | admin | set | messages: +msg6349 |
| 2020-12-15 00:00:00 | admin | set | status: drafting -> cd5 |
| 2015-09-02 00:00:00 | admin | create | |