Title
Example with empty anonymous union member
Status
cd5
Section
11.5 [class.union]
Submitter
John Spicer

Created on 2015-02-03.00:00:00 last changed 5 months ago

Messages

Date: 2021-02-17.00:00:00

Additional note, February, 2021:

The issue was resolved editorially.

Date: 2015-02-03.00:00:00

The example in 11.5 [class.union] paragraph 8 reads,

  union U {
    int x = 0;
    union { };
    union {
      int z;
      int y = 1; // error: initialization for second variant member of U
    };
  };

The empty anonymous union appears to be a violation of the requirement in 11.4 [class.mem] paragraph 1,

Except when used to declare friends (11.8.4 [class.friend]), to declare an unnamed bit-field (11.4.10 [class.bit]), or to introduce the name of a member of a base class into a derived class (9.9 [namespace.udecl]), or when the declaration is an empty-declaration, member-declarations declare members of the class, and each such member-declaration shall declare at least one member name of the class.
History
Date User Action Args
2021-02-17 00:00:00adminsetmessages: + msg6516
2021-02-17 00:00:00adminsetstatus: drafting -> cd5
2015-02-03 00:00:00admincreate