aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaDecl.cpp10
-rw-r--r--test/Parser/cxx-undeclared-identifier.cpp6
2 files changed, 13 insertions, 3 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 76334e9a12..5bb0b524d1 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -5329,9 +5329,13 @@ CreateNewDecl:
// Maybe add qualifier info.
if (SS.isNotEmpty()) {
- NestedNameSpecifier *NNS
- = static_cast<NestedNameSpecifier*>(SS.getScopeRep());
- New->setQualifierInfo(NNS, SS.getRange());
+ if (SS.isSet()) {
+ NestedNameSpecifier *NNS
+ = static_cast<NestedNameSpecifier*>(SS.getScopeRep());
+ New->setQualifierInfo(NNS, SS.getRange());
+ }
+ else
+ Invalid = true;
}
if (Kind != TTK_Enum) {
diff --git a/test/Parser/cxx-undeclared-identifier.cpp b/test/Parser/cxx-undeclared-identifier.cpp
new file mode 100644
index 0000000000..36d8f7a653
--- /dev/null
+++ b/test/Parser/cxx-undeclared-identifier.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
+
+class Foo::Bar { // expected-error {{use of undeclared identifier 'Foo'}} \
+ // expected-note {{to match this '{'}} \
+ // expected-error {{expected ';' after class}}
+ // expected-error {{expected '}'}}