Created on2014-10-08.00:00:00 last changed62 months ago
Proposed resolution (January, 2019):
Change 6.3 [basic.def.odr] paragraph 2 as follows:
An expressionor conversionispotentially evaluated unless it isan unevaluated operand (7.2 [expr.prop]),ora subexpression thereof, or a conversion inan initialization or conversion sequence in such acontext. The set ofpotential results of anexpressione is defined as follows:...
Cbange 6.3 [basic.def.odr] paragraph 3 as follows:
A function isnamed by
anexpressionan expression or conversionas follows:
A function
whose name appears in anexpressionis named bythatanexpressionor conversion if it is the uniquelookupresultof a name lookup or theselected member of a set of overloaded functions(6.5 [basic.lookup], 12.2 [over.match],12.3 [over.over])in an overload resolutionperformed as part of forming that expression orconversion, unless it is a pure virtual function andeitherits name is notthe expression is not anid-expression namingthe function with anexplicitlyqualifiedname or the expression forms a pointerto member (7.6.2.2 [expr.unary.op]). [Note: Thiscovers taking the address of functions(7.3.4 [conv.func], 7.6.2.2 [expr.unary.op]),calls to named functions (7.6.1.3 [expr.call]),operator overloading (Clause 12 [over]),user-defined conversions (11.4.8.3 [class.conv.fct]),allocation functions forplacementnew-expressions (7.6.2.8 [expr.new]), aswell as non-default initialization(9.5 [dcl.init]). A constructor selected to copyor move an object of class type is considered to be named byan expressionor conversion even if the call isactually elided by the implementation(11.9.6 [class.copy.elision]). —endnote]A
n allocation ordeallocation function fora class is named by anew-expressionif it isthe single matching deallocation function for the allocationfunction selected by o verload resolution, asspecified in 7.6.2.8 [expr.new]and11.4.11 [class.free].A deallocation function for a class is named by a
deleteexpressiondelete-expression if it is the selected usualdeallocation function as specified in7.6.2.9 [expr.delete] and11.4.11 [class.free].
Change 6.3 [basic.def.odr] paragraph 7 as follows:
A virtual member function is odr-used if it is not pure. Afunction is odr-used if it is named by apotentially-evaluated expressionor conversion. Anon-placement...
[Accepted as a DR at the February, 2019 meeting.]
According to 6.3 [basic.def.odr] paragraph 3,
A function whose name appears as a potentially-evaluatedexpression is odr-used if it is the unique lookup result orthe selected member of a set of overloaded functions(6.5 [basic.lookup], 12.2 [over.match],12.3 [over.over]), unless it is a pure virtualfunction and its name is not explicitlyqualified. [Note: This covers calls to namedfunctions (7.6.1.3 [expr.call]), operator overloading(Clause 12 [over]), user-defined conversions(11.4.8.3 [class.conv.fct]), allocation function forplacement new (7.6.2.8 [expr.new]), as well asnon-default initialization (9.5 [dcl.init]). Aconstructor selected to copy or move an object of class typeis odr-used even if the call is actually elided by theimplementation (11.4.5.3 [class.copy.ctor]). —endnote] An allocation or deallocation function for a classis odr-used by a new expression appearing in apotentially-evaluated expression as specified in7.6.2.8 [expr.new] and 11.4.11 [class.free]. Adeallocation function for a class is odr-used by a deleteexpression appearing in a potentially-evaluated expressionas specified in 7.6.2.9 [expr.delete] and11.4.11 [class.free].
There are a couple of problems with this specification. First,contrary to the note, the names of overloaded operators, conversionfunctions, etc., do not appear in potentially-evaluated expressions,so the normative text does not make the note true. Also, the“as specified in” references do not cover odr-useexplicitly, only the invocation of the functions.
One possible way of addressing these deficiencies would be ablanket rule like,
A function is odr-used if it is invoked by a potentially-evaluatedexpression.
(The existing wording about appearing in a potentially-evaluatedexpression would still be needed for non-call references.)
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2020-12-15 00:00:00 | admin | set | messages: +msg6346 |
| 2020-12-15 00:00:00 | admin | set | status: drafting -> cd5 |
| 2014-10-08 00:00:00 | admin | create | |