Created on2014-12-03.00:00:00 last changed48 months ago
Proposed resolution (January, 2019):
Change 7.2.1 [basic.lval] paragraph 11 as follows:
If a program attempts to access the stored value of anobject through a glvalue
of other thanwhose type is not similar (7.3.6 [conv.qual])to one of the following types the behavior isundefined:58
the dynamic type of the object,
a cv-qualified version of the dynamic type of the object,
a type similar (as defined in 7.3.6 [conv.qual]) tothe dynamic type of the object,a type that is the signed or unsigned typecorresponding to the dynamic type of the object,
a type that is the signed or unsigned typecorresponding to a cv-qualified version of the dynamic typeof the object,
an aggregate or union type that includes one of theaforementioned types among its elements or non-static datamembers (including, recursively, an element or non-staticdata member of a subaggregate or contained union),
a type that is a (possibly cv-qualified) base class type ofthe dynamic type of the object,achar,unsigned char, orstd::byte type.
If a program invokes a defaulted copy/move constructoror copy/move assignment operator for a union of typeUwith a glvalue argument that does not denote an object of typecvU within its lifetime, the behavior isundefined. [Note: Unlike in C, C++ has no accesses ofclass type. —end note]
Change 7.3.6 [conv.qual] paragraph 1 as follows:
Acv-decomposition of a typeTis a sequence ofcviandPi such thatT is
“cv0 P0 ··· cvn-1 Pn-1 cvnU” forn
>≥ 0,where...
Additional note, October, 2015:
It has been suggested that the aliasing rules should be extended to permit an object ofan enumeration with a fixed underlying type to alias an object withthat underlying type.
Suggested resolution:
Replace 7.2.1 [basic.lval] paragraph 10 as follows:
If a program attempts to access the stored value of an objectthrough a glvalue whose type is not similar (7.3.6 [conv.qual])to one of the following types the behavior is undefined:[Footnote:... —end footnote]
the dynamic type of the object,
the signed or unsigned type corresponding to the dynamictype of the object, or
achar orunsigned char type.
[Accepted as a DR at the February, 2019 meeting.]
The aliasing rules of 7.2.1 [basic.lval] paragraph 10 wereadapted from C with additions for C++. However, a number of the pointseither do not apply or are subsumed by other points. For example, theprovision for aggregate and union types is needed in C for structassignment, which in C++ is done via constructors and assignmentoperators in C++, not by accessing the complete object.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-02-18 07:47:23 | admin | set | messages: +msg6710 |
| 2020-12-15 00:00:00 | admin | set | messages: +msg6370 |
| 2020-12-15 00:00:00 | admin | set | status: drafting -> cd5 |
| 2015-11-10 00:00:00 | admin | set | messages: +msg5640 |
| 2014-12-03 00:00:00 | admin | create | |