]> granicus.if.org Git - clang/commitdiff
C++ allows empty enum list.
authorChris Lattner <sabre@nondot.org>
Mon, 27 Aug 2007 17:24:30 +0000 (17:24 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 27 Aug 2007 17:24:30 +0000 (17:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41498 91177308-0d34-0410-b5e6-96231b3b80d8

Parse/ParseDecl.cpp

index 6a617128ad575c863b8ad7b92098a27007210d31..8a0318417829ed53c61da8bcb7fd6f900d0d644a 100644 (file)
@@ -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<DeclTy*, 32> EnumConstantDecls;