Skip to content

CWG3079 [class.union.anon] Permit empty-declaration in anonymous unions #755

Description

@keinflue

Reference (section label): [class.union.anon]

Issue description:

Currently [class.union.anon]p2 says:

Each member-declaration in the member-specification of an anonymous union shall either define one or more public non-static data members or be a static_assert-declaration.

This prohibits empty declarations in anonymous unions, i.e.

struct A { union {int x;;} u; }; //ok
struct B { union {int y;;}; }; //error

I do not see any motivation for this discrepancy.

Suggested resolution:

Modify the quoted sentence:

Each member-declaration in the member-specification of an anonymous union shall either define one or more public non-static data members, be an empty-declaration or be a static_assert-declaration .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions