Title
Unions and aliasing
Status
nad
Section
7.2.1 [basic.lval]
Submitter
comp.std.c++

Created on 2006-06-10.00:00:00 last changed 212 months ago

Messages

Date: 2006-10-15.00:00:00

Rationale (October, 2006):

As noted in the issue, not all unions are aggregates, but those that are not aggregates still allow aliasing. That part of the specification would be lost with the suggested change.

Date: 2022-11-20.07:54:16

The C++ standard says in 7.2.1 [basic.lval], in paragraph 15:

  • an aggregate or union type that includes one of the aforementioned types among its members (including, recursively, a member of a subaggregate or contained union),

Note that it is a literal copy from the C standard, but this is of course not the problem.

In C, union is not defined as an aggregate type. Therefore it is appropriate to say “aggregate or union.” But things changed in C++: aggregate type includes union type now (though not all unions are aggregates), and it becomes clear that the “union” in “aggregate or union” is redundant and should be deleted.

The above cited paragraph could be changed to:

  • an aggregate type that includes one of the aforementioned types among its members (including, recursively, a member of a subaggregate)

History
Date User Action Args
2006-11-05 00:00:00adminsetmessages: + msg1452
2006-11-05 00:00:00adminsetstatus: open -> nad
2006-06-10 00:00:00admincreate