From owner-sc22wg14+sc22wg14-domo2=www.open-std.org@open-std.org  Thu Jul 28 18:14:40 2016
Return-Path: <owner-sc22wg14+sc22wg14-domo2=www.open-std.org@open-std.org>
X-Original-To: sc22wg14-domo2
Delivered-To: sc22wg14-domo2@www.open-std.org
Received: by www.open-std.org (Postfix, from userid 521)
	id 11D8635889E; Thu, 28 Jul 2016 18:14:40 +0200 (CEST)
Delivered-To: sc22wg14@open-std.org
X-Greylist: delayed 1348 seconds by postgrey-1.34 at www5.open-std.org; Thu, 28 Jul 2016 18:14:39 CEST
Received: from relay1.mentorg.com (relay1.mentorg.com [192.94.38.131])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by www.open-std.org (Postfix) with ESMTP id B0A38358679
	for <sc22wg14@open-std.org>; Thu, 28 Jul 2016 18:14:38 +0200 (CEST)
Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com)
	by relay1.mentorg.com with esmtp 
	id 1bSnbQ-0002cp-Nx from joseph_myers@mentor.com 
	for sc22wg14@open-std.org; Thu, 28 Jul 2016 08:52:04 -0700
Received: from digraph.polyomino.org.uk (137.202.0.76) by
 SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id
 14.3.224.2; Thu, 28 Jul 2016 16:52:02 +0100
Received: from jsm28 (helo=localhost)	by digraph.polyomino.org.uk with
 local-esmtp (Exim 4.86_2)	(envelope-from <joseph@codesourcery.com>)	id
 1bSnbN-0000lV-G9	for sc22wg14@open-std.org; Thu, 28 Jul 2016 15:52:01 +0000
Date: Thu, 28 Jul 2016 15:52:01 +0000
From: Joseph Myers <joseph@codesourcery.com>
X-X-Sender: jsm28@digraph.polyomino.org.uk
To: "sc22wg14@open-std.org" <sc22wg14@open-std.org>
Subject: Re: (SC22WG14.14298) flexible array member in an anonymous struct
In-Reply-To: <20160728154347.8BE3D3587A8@www.open-std.org>
Message-ID: <alpine.DEB.2.20.1607281546030.12533@digraph.polyomino.org.uk>
References: <20160728154347.8BE3D3587A8@www.open-std.org>
User-Agent: Alpine 2.20 (DEB 67 2015-01-07)
MIME-Version: 1.0
Content-Type: text/plain; charset="US-ASCII"
Sender: owner-sc22wg14@open-std.org
Precedence: bulk

On Thu, 28 Jul 2016, Martin Sebor wrote:

> I think another reasonable interpretation is that since according
> to 6.7.2.1, p3, "members of an anonymous structure or union are
> considered to be members of the containing structure or union,"
> the code above is valid.

Note that the "considered to be members" wording also caused the confusion 
described in DR#499.  My understanding has always been that the layout is 
exactly as if the contained anonymous structure or union had a name (so it 
acts like a structure is declared as such even if contained in a union, or 
like a union if declared as such even if contained in a structure), with 
all the usual constraints applying to the contained structure or union, 
and the only difference being a shorthand notation for naming members of 
the contained structure or union.

Note also that this feature is not a committee invention (although the 
interaction with flexible array members may be); it may have originated in 
MS or Plan 9 compilers.

-- 
Joseph S. Myers
joseph@codesourcery.com
