Created on 2025-07-09.00:00:00 last changed 2 weeks ago
Suggested resolution:
Change in 7.6.1.5 [expr.ref] bullet 8.2 and 8.6 as follows:
- ...
- Otherwise, if E2 designates a non-static data member
and the type of E1 is “cq1 vq1 X”, and the type of E2 is “cq2 vq2 T”, the expression designates the corresponding member subobject of the object designated by E1 and its type is the type that a member subobject corresponding to the member designated by E2 would have in an object whose type is that of E1 (11.4.1 [class.mem.general]). If E1 is an lvalue, then E1.E2 is an lvalue; otherwise E1.E2 is an xvalue.Let the notation vq12 stand for the “union” of vq1 and vq2 ; that is, if vq1 or vq2 is volatile, then vq12 is volatile. Similarly, let the notation cq12 stand for the “union” of cq1 and cq2 ; that is, if cq1 or cq2 is const, then cq12 is const. If the entity designated by E2 is declared to be a mutable member, then the type of E1.E2 is “vq12 T”. If the entity designated by E2 is not declared to be a mutable member, then the type of E1.E2 is “cq12 vq12 T”.- ...
- Otherwise, if E2 designates a direct base class relationship (D, B) and the type of E1 is cv T, the expression designates the direct base class subobject of type
B"cv B" of the object designated by E1. If E1 is an lvalue, then E1.E2 is an lvalue; otherwise, E1.E2 is an xvalue. The type of E1.E2 is “cv B”.
Change in 11.4.1 [class.mem.general] paragraph 6 as follows:
Every object of class type has a unique member subobject corresponding to each of its direct non-static data members. For a non-static data member of non-reference type "cq2 vq2 T" that is a direct member of an object whose type is "cq1 vq1 C", let vq12 be volatile if either vq1 or vq2 is volatile, and empty otherwise, and let cq12 be const if either cq1 or cq2 is const, and empty otherwise. If the member is declared mutable, then the type of the corresponding subobject is "vq12 T"; otherwise, the type of the corresponding subobject is "cq12 vq12 T". If any non-static data member of a class C is of reference type, then let D be an invented class that is identical to C except that each non-static member of D corresponding to a member of C of type “reference to T” instead has type “pointer to T”. Every member subobject of a complete object of type C has the same size, alignment, and offset as that of the corresponding subobject of a complete object of type D. The size and alignment of C are the same as the size and alignment of D.
Change in 11.7.2 [class.mi] paragraph 4 as follows:
A base class specifier that does not contain the keyword virtual specifies a non-virtual base class. A base class specifier that contains the keyword virtual specifies a virtual base class. For each distinct occurrence of a non-virtual base class A in the class lattice of the most derived class C,thea most derived object (6.8.2 [intro.object]) of type "cv C" shall contain a corresponding distinct base class subobject ofthattype "cv A". For each distinct base class B that is specified virtual, the most derived object shall contain a single base class subobject of that type "cv B".
(From submission #726.)
The standard does not appear to specify the types of member subobjects. In particular, the manner in which the cv-qualifiers of the type of the enclosing class object combine with those of the member declaration is specified only for member access expressions (7.6.1.5 [expr.ref]), not for the type of the subobject itself.
History | |||
---|---|---|---|
Date | User | Action | Args |
2025-08-13 22:07:55 | admin | set | messages: + msg8071 |
2025-07-09 00:00:00 | admin | create |