Skip to content

[class.mem.general] Missing specification for types of member subobjects #726

Open
@t3nsor

Description

@t3nsor

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 by E2 would have in an object whose type is that of E1 ([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 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 data 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 type, 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions