https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71939

--- Comment #1 from joseph at codesourcery dot com <joseph at codesourcery dot 
com> ---
On Wed, 20 Jul 2016, msebor at gcc dot gnu.org wrote:

> While testing a fix for bug 71912 and comparing the C++ front end results to
> those of the C front end I came across the following test case that's accepted
> in C++ but rejected in C.  By my reading of C11 the test case is valid because
> "members of an anonymous structure or union are considered to be members of 
> the
> containing structure or union" and so struct S should be treated as if it had
> been defined as:

I think the anonymous structures/unions feature is and always has been 
intended to be (in the MS and Plan 9 extensions from which the feature 
came, as well as in C++ and C11) purely a matter of a shorthand for naming 
members of a nested structure or union.  So the nested anonymous structure 
or union is subject to all the constraints applicable to one that is not 
anonymous or not nested inside another structure or union (the case in 
point here), and layout is exactly as if all those structures or unions 
were given names (the point that apparently confused some people enough to 
result in the filing of DR#499).  I.e., there is no bug here.

Reply via email to