This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 113d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-03-20


1940. static_assert in anonymous unions

Section: 11.5  [class.union]     Status: CD4     Submitter: Richard Smith     Date: 2014-06-12

[Moved to DR at the November, 2014 meeting.]

C++ allows only non-static data member declarations in an anonymous union, but C and several C++ implementations permit static_assert declarations. Should the C++ Standard be changed accordingly?

Proposed resolution (June, 2014):

Change 11.5 [class.union] paragraph 5 as follows:

A union of the form

is called an anonymous union; it defines an unnamed object of unnamed type. The member-specification of an anonymous union shall only define non-static data members Each member-declaration in the member-specification of an anonymous union shall either define a non-static data member or be a static_assert-declaration. [Note:...