summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-07-13 06:24:26 +0000
committerDouglas Gregor <dgregor@apple.com>2010-07-13 06:24:26 +0000
commitaa8c97262a2f6de0096b5bf913d084c22261b248 (patch)
tree4109c2f31061bfd3926f839902a1e8be1acd0c2a /clang/lib
parenta700f688282a1984164a2a95590eb39284fb4272 (diff)
downloadbcm5719-llvm-aa8c97262a2f6de0096b5bf913d084c22261b248.tar.gz
bcm5719-llvm-aa8c97262a2f6de0096b5bf913d084c22261b248.zip
Complain when an unnamed enumeration has no enumerations (in
C++). Fixes PR7466. llvm-svn: 108231
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 318ae494f13..7d90792376d 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -1539,6 +1539,14 @@ Sema::DeclPtrTy Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS,
return DeclPtrTy::make(Tag);
}
+ if (getLangOptions().CPlusPlus &&
+ DS.getStorageClassSpec() != DeclSpec::SCS_typedef)
+ if (EnumDecl *Enum = dyn_cast_or_null<EnumDecl>(Tag))
+ if (Enum->enumerator_begin() == Enum->enumerator_end() &&
+ !Enum->getIdentifier() && !Enum->isInvalidDecl())
+ Diag(Enum->getLocation(), diag::ext_no_declarators)
+ << DS.getSourceRange();
+
if (!DS.isMissingDeclaratorOk() &&
DS.getTypeSpecType() != DeclSpec::TST_error) {
// Warn about typedefs of enums without names, since this is an
OpenPOWER on IntegriCloud