[cfe-dev] empty enum

Eli Friedman eli.friedman at gmail.com
Sat Apr 26 21:42:01 PDT 2008


clang should produce a warning with -pedantic... clang doesn't attempt
to conform to the C99 rules for diagnostics without the -pedantic
option.

Is there any particular reason clang should reject this construct?

-Eli

On Sat, Apr 26, 2008 at 6:02 PM, Patrick Flannery
<foster_flannery at yahoo.com> wrote:
>
> Is it correct that clang does not produce an error for an empty enum?
> cat test.c
> enum Empty{};
> clang test.c  -> no warnings or errors
>
> gcc test.c
> /Users/patrickflannery/test.c:1: error: parse error before '}' token
>
> The code in ParseEnumBody would only omit a warning with pedantic.
>
> // C does not allow an empty enumerator-list, C++ does [dcl.enum].
> if (Tok.is(tok::r_brace) && !getLang().CPlusPlus)
>     Diag(Tok, diag::ext_empty_struct_union_enum, "enum");
>
> Patrick
>
>
>  ________________________________
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it
> now.
> _______________________________________________
>  cfe-dev mailing list
>  cfe-dev at cs.uiuc.edu
>  http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>



More information about the cfe-dev mailing list