This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Undefined behavior due to 6.5.16.1p3


On Wed, 11 Mar 2015, Vincent Lefevre wrote:

> BTW, the following is forbidden (and makes no sense), but is accepted
> by GCC without a warning:
> 
> int foo (void)
> {
>   union { char a[8]; int b; } u = { .a = { 0 }, .b = 1 };
>   return u.b;
> }

What constraint do you think forbids it?  It looks like an ordinary case 
of overriding with designated initializers.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]