From: Chris Lattner Date: Mon, 27 Aug 2007 17:24:30 +0000 (+0000) Subject: C++ allows empty enum list. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7946dd363beaa92e8d03ef199ffedaab58714058;p=clang C++ allows empty enum list. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41498 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Parse/ParseDecl.cpp b/Parse/ParseDecl.cpp index 6a617128ad..8a03184178 100644 --- a/Parse/ParseDecl.cpp +++ b/Parse/ParseDecl.cpp @@ -803,7 +803,8 @@ void Parser::ParseEnumSpecifier(DeclSpec &DS) { void Parser::ParseEnumBody(SourceLocation StartLoc, DeclTy *EnumDecl) { SourceLocation LBraceLoc = ConsumeBrace(); - if (Tok.getKind() == tok::r_brace) + // C does not allow an empty enumerator-list, C++ does [dcl.enum]. + if (Tok.getKind() == tok::r_brace && !getLang().CPlusPlus) Diag(Tok, diag::ext_empty_struct_union_enum, "enum"); llvm::SmallVector EnumConstantDecls;