diff options
-rw-r--r-- | include/clang/Parse/Parser.h | 13 | ||||
-rw-r--r-- | test/SemaCXX/nested-name-spec.cpp | 5 |
2 files changed, 13 insertions, 5 deletions
diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h index 677cd819ca..50145ae530 100644 --- a/include/clang/Parse/Parser.h +++ b/include/clang/Parse/Parser.h @@ -1080,17 +1080,22 @@ private: class DeclaratorScopeObj { Parser &P; CXXScopeSpec &SS; + bool EnteredScope; public: - DeclaratorScopeObj(Parser &p, CXXScopeSpec &ss) : P(p), SS(ss) {} + DeclaratorScopeObj(Parser &p, CXXScopeSpec &ss) + : P(p), SS(ss), EnteredScope(false) {} void EnterDeclaratorScope() { - if (SS.isSet()) - P.Actions.ActOnCXXEnterDeclaratorScope(P.CurScope, SS); + assert(SS.isSet() && "C++ scope was not set!"); + P.Actions.ActOnCXXEnterDeclaratorScope(P.CurScope, SS); + EnteredScope = true; } ~DeclaratorScopeObj() { - if (SS.isSet()) + if (EnteredScope) { + assert(SS.isSet() && "C++ scope was cleared ?"); P.Actions.ActOnCXXExitDeclaratorScope(P.CurScope, SS); + } } }; diff --git a/test/SemaCXX/nested-name-spec.cpp b/test/SemaCXX/nested-name-spec.cpp index 8fff8a2b2c..97f31033e8 100644 --- a/test/SemaCXX/nested-name-spec.cpp +++ b/test/SemaCXX/nested-name-spec.cpp @@ -172,7 +172,10 @@ X::X() : a(5) { } // expected-error{{use of undeclared identifier 'X'}} \ // expected-error{{C++ requires a type specifier for all declarations}} \ // expected-error{{only constructors take base initializers}} - +struct foo_S { + static bool value; +}; +bool (foo_S::value); namespace somens { |