aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Parse/ParseTentative.cpp8
-rw-r--r--test/FixIt/fixit.cpp12
2 files changed, 18 insertions, 2 deletions
diff --git a/lib/Parse/ParseTentative.cpp b/lib/Parse/ParseTentative.cpp
index 28c5e8b673..b5251a6177 100644
--- a/lib/Parse/ParseTentative.cpp
+++ b/lib/Parse/ParseTentative.cpp
@@ -931,8 +931,12 @@ Parser::isCXXDeclarationSpecifier(Parser::TPResult BracedCastResult) {
// recurse to handle whatever we get.
if (TryAnnotateTypeOrScopeToken())
return TPResult::Error();
- if (Tok.is(tok::identifier))
- return TPResult::False();
+ if (Tok.is(tok::identifier)) {
+ const Token &Next = NextToken();
+ bool NotObjC = !(getLangOpts().ObjC1 || getLangOpts().ObjC2);
+ return (NotObjC && Next.is(tok::identifier)) ?
+ TPResult::True() : TPResult::False();
+ }
return isCXXDeclarationSpecifier(BracedCastResult);
case tok::coloncolon: { // ::foo::bar
diff --git a/test/FixIt/fixit.cpp b/test/FixIt/fixit.cpp
index 7d531a537a..afa71c6f3d 100644
--- a/test/FixIt/fixit.cpp
+++ b/test/FixIt/fixit.cpp
@@ -204,3 +204,15 @@ template<template<typename> Foo, // expected-error {{template template parameter
template<typename> typename Bar, // expected-error {{template template parameter requires 'class' after the parameter list}}
template<typename> struct Baz> // expected-error {{template template parameter requires 'class' after the parameter list}}
void func();
+
+
+namespace ShadowedTagType {
+class Foo {
+ public:
+ enum Bar { X, Y };
+ void SetBar(Bar bar);
+ Bar Bar();
+ private:
+ Bar bar_; // expected-error {{must use 'enum' tag to refer to type 'Bar' in this scope}}
+};
+void Foo::SetBar(Bar bar) { bar_ = bar; } // expected-error {{must use 'enum' tag to refer to type 'Bar' in this scope}}