Description
Full name of submitter: Brian Bi
Issue description: 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 ([expr.ref]), not for the type of the subobject itself.
Suggested resolution: Wording is relative to P3293R3 (adopted in Sofia).
Edit [expr.ref]/7.2:
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 byE2
would have in an object whose type is that ofE1
([class.mem.general]). If E1 is an lvalue, then E1.E2 is an lvalue; otherwise E1.E2 is an xvalue.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”.
Edit [class.mem.general]/6+:
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 vq1C
", let vq12 bevolatile
if either vq1 or vq2 isvolatile
, and empty otherwise, and let cq12 beconst
if either cq1 or cq2 isconst
, and empty otherwise. If the member is declaredmutable
, then the type of the corresponding subobject is "vq12T
"; otherwise, the type of the corresponding subobject is "cq12 vq12T
". If any non-static data member of a classC
is of reference type, then letD
be an invented class that is identical toC
except that each non-static data member ofD
corresponding to a member ofC
of type "reference toT
" instead has type "pointer toT
". Every member subobject of a complete object of typeC
has the same type, size, alignment, and offset as that of the corresponding subobject of a complete object of typeD
. The size and alignment ofC
are the same as the size and alignment ofD
.