[cfe-dev] warning: declaration does not declare anything / error: no member named 'LOW' in 'STRUCT'
Richard Smith via cfe-dev
cfe-dev at lists.llvm.org
Mon Jul 30 12:52:17 PDT 2018
Would it make sense to add a -fplan9-extensions flag, to enable support for
this without enabling all the other MS extensions that we support?
On Mon, 30 Jul 2018 at 11:53, Friedman, Eli via cfe-dev <
cfe-dev at lists.llvm.org> wrote:
> On 7/30/2018 9:08 AM, Frank Redeker via cfe-dev wrote:
> > Hello List,
> >
> > Given the following piece of code.
> >
> > typedef union {
> > struct {
> > unsigned char LOW;
> > unsigned char HIGH;
> > };
> > unsigned short SHORT;
> > } UNION;
> >
> > typedef struct {
> > UNION; // <-- use of type only
> > union {
> > unsigned char FOO;
> > };
> > } STRUCT;
> >
> > STRUCT Variable;
> >
> > void Function () {
> > Variable.LOW = 1;
> > }
> >
> >
> > This code compiles without any error using gcc 7.2 (When compiling with
> > -ansi -pedantic I get the warning "ISO C90 doesn't support unnamed
> > structs/unions". If I add -std=c11 the warning disappears)
>
> Declaring an anonymous union like that non-standard; you need to pass
> -fms-extensions.
>
> -Eli
>
> --
> Employee of Qualcomm Innovation Center, Inc.
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux
> Foundation Collaborative Project
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180730/d6738927/attachment.html>
More information about the cfe-dev
mailing list