summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-12-04 00:07:04 +0000
committerJohn McCall <rjmccall@apple.com>2009-12-04 00:07:04 +0000
commit9f545181f7265b7559691da411b845ebba4d91c8 (patch)
treeae95f5a25b5bea6b1a13441564a9f0df2413cb51 /clang/lib/Sema
parent0ecd4c7d7004940f29d4ae064288a94befa2a6c6 (diff)
downloadbcm5719-llvm-9f545181f7265b7559691da411b845ebba4d91c8.tar.gz
bcm5719-llvm-9f545181f7265b7559691da411b845ebba4d91c8.zip
When recovering from an invalid forward reference to an enum type in C++,
create the enum type in the same scope as you would a record type. llvm-svn: 90500
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index e02849f5d59..3e29b726e89 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -4617,8 +4617,7 @@ Sema::DeclPtrTy Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
Previous.clear();
}
}
- } else if (TUK == TUK_Reference && SS.isEmpty() && Name &&
- (Kind != TagDecl::TK_enum || !getLangOptions().CPlusPlus)) {
+ } else if (TUK == TUK_Reference && SS.isEmpty() && Name) {
// C++ [basic.scope.pdecl]p5:
// -- for an elaborated-type-specifier of the form
//
@@ -4636,6 +4635,11 @@ Sema::DeclPtrTy Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
// C99 6.7.2.3p8 has a similar (but not identical!) provision for
// C structs and unions.
//
+ // It is an error in C++ to declare (rather than define) an enum
+ // type, including via an elaborated type specifier. We'll
+ // diagnose that later; for now, declare the enum in the same
+ // scope as we would have picked for any other tag type.
+ //
// GNU C also supports this behavior as part of its incomplete
// enum types extension, while GNU C++ does not.
//
OpenPOWER on IntegriCloud