[cfe-dev] empty enum

Patrick Flannery foster_flannery at yahoo.com
Sat Apr 26 18:02:15 PDT 2008


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.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080426/7fef1e0e/attachment.html>


More information about the cfe-dev mailing list