Created on 2021-07-02.00:00:00 last changed 27 months ago
Proposed resolution, December, 2021:
Change 6.3 [basic.def.odr] paragraph 1 as follows:
Each of the following is termed a definable item:
a class type ( Clause 11 [class]),
an enumeration type (9.7.1 [dcl.enum]),
a function (9.3.4.6 [dcl.fct]),
a variable (6.1 [basic.pre]),
a templated entity (13.1 [temp.pre]),
a default argument for a parameter (for a function in a given scope) (9.3.4.7 [dcl.fct.default]), or
a default template argument (13.2 [temp.param]).
No translation unit shall contain more than one definition of any
variable, function, class type, enumeration type, template, default argument for a parameter (for a function in a given scope), or default template argumentdefinable item.
Change 6.3 [basic.def.odr] paragraph 10 as follows:
Every program shall containexactlyat least one definition of everynon-inlinefunction or variable that is odr-used in that program outside of a discarded statement (8.5.2 [stmt.if]); no diagnostic required. The definition...
Change 6.3 [basic.def.odr] paragraph 13 as follows:
There can be more than one definition of a
class type (Clause 11 [class]),
enumeration type (9.7.1 [dcl.enum]),
inline function or variable (9.2.8 [dcl.inline]),
templated entity (13.1 [temp.pre]),
default argument for a parameter (for a function in a given scope) (9.3.4.7 [dcl.fct.default]), or
default template argument (13.2 [temp.param])
in a program provided that each definition appears in a different translation unit and the definitions satisfy the following requirements.For any definable item D with definitions in multiple translation units,
if D is a non-inline non-templated function or variable, or
if the definitions in different translation units do not satisfy the following requirements,
the program is ill-formed; a diagnostic is required only if the definable item is attached to a named module and a prior definition is reachable at the point where a later definition occurs. Given such an
entity D defined in more than one translation unititem, for all definitions of D, or, if D is an unnamed enumeration, for all definitions of D that are reachable at any given program point, the following requirements shall be satisfied...
Delete 6.3 [basic.def.odr] paragraph 15:
If these definitions do not satisfy these requirements, then the program is ill-formed; a diagnostic is required only if the entity is attached to a named module and a prior definition is reachable at the point where a later definition occurs.
Notes from the August, 2021 teleconference:
CWG observed that there is a similar problem in paragraph 13. See also issue 1849.
[Accepted at the February, 2022 meeting.]
According to 6.3 [basic.def.odr] paragraph 10,
Every program shall contain exactly one definition of every non-inline function or variable that is odr-used in that program outside of a discarded statement (8.5.2 [stmt.if]); no diagnostic required.
This wording could be interpreted as allowing multiple definitions of non-inline variables and functions if they are not odr-used. That is presumably not the intent.
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-08-19 07:54:33 | admin | set | status: dr -> cd6 |
2022-02-15 00:00:00 | admin | set | status: ready -> dr |
2022-01-06 00:00:00 | admin | set | messages: + msg6595 |
2022-01-06 00:00:00 | admin | set | status: drafting -> ready |
2021-11-15 00:00:00 | admin | set | messages: + msg6535 |
2021-07-02 00:00:00 | admin | create |