Date: Thu, 5 May 2022 15:35:03 +0200
Aaron,
on Thu, 5 May 2022 09:01:47 -0400 you (Aaron Ballman via Liaison
<liaison_at_[hidden]>) wrote:
> 6.7.2.1p15: An unnamed member whose type specifier is a structure
> specifier with no tag is called an anonymous structure; an unnamed
> member whose type specifier is a union specifier with no tag is called
> an anonymous union. The members of an anonymous structure or union are
> considered to be members of the containing structure or union, keeping
> their structure or union layout. This applies recursively if the
> containing structure or union is also anonymous.
> ...
> I *think* what may have been intended is for 6.7.2.1p15 to instead say
> something along the lines of: ... The members of an anonymous
> structure or union are considered to be members of the containing
> structure or union, keeping their structure or union layout <ins>and
> the qualifiers specified for the unnamed member</ins>. ...
This would have made that clearer, but I think that this already
follows, anyhow. The type of `bar` is indeed `int const` and not
`int`. The `const` of the surrounding structure comes from the part in
6.3.2.1p1 that you cited
... and if it is a structure or union, does not have any
member (including, recursively, any member or element of all
contained aggregates or unions) with a const-qualified type.
This specification doesn't exclude unnamed members, and so
`<anonymous>.bar` is not a modifiable lvalue.
But you are right that this could all be clearer by pushing it on the
syntax somehow:
If a member is an agreate or union type and is `const` or
`volatile` qualified, all of its members, even recursively are
so qualified.
Jₑₙₛ
on Thu, 5 May 2022 09:01:47 -0400 you (Aaron Ballman via Liaison
<liaison_at_[hidden]>) wrote:
> 6.7.2.1p15: An unnamed member whose type specifier is a structure
> specifier with no tag is called an anonymous structure; an unnamed
> member whose type specifier is a union specifier with no tag is called
> an anonymous union. The members of an anonymous structure or union are
> considered to be members of the containing structure or union, keeping
> their structure or union layout. This applies recursively if the
> containing structure or union is also anonymous.
> ...
> I *think* what may have been intended is for 6.7.2.1p15 to instead say
> something along the lines of: ... The members of an anonymous
> structure or union are considered to be members of the containing
> structure or union, keeping their structure or union layout <ins>and
> the qualifiers specified for the unnamed member</ins>. ...
This would have made that clearer, but I think that this already
follows, anyhow. The type of `bar` is indeed `int const` and not
`int`. The `const` of the surrounding structure comes from the part in
6.3.2.1p1 that you cited
... and if it is a structure or union, does not have any
member (including, recursively, any member or element of all
contained aggregates or unions) with a const-qualified type.
This specification doesn't exclude unnamed members, and so
`<anonymous>.bar` is not a modifiable lvalue.
But you are right that this could all be clearer by pushing it on the
syntax somehow:
If a member is an agreate or union type and is `const` or
`volatile` qualified, all of its members, even recursively are
so qualified.
Jₑₙₛ
-- :: INRIA Nancy Grand Est ::: Camus ::::::: ICube/ICPS ::: :: :::::::::::::::::::::: gsm France : +33 651400183 :: :: ::::::::::::::: gsm international : +49 15737185122 :: :: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::
Received on 2022-05-05 13:35:07