CWG Issue 1940 (original) (raw)

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

2025-11-05


1940.static_assert in anonymous unions

Section: 11.5 [class.union]Status: CD4Submitter: Richard SmithDate: 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

union { member-specification } ;

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:...