When recovering from a qualified typedef name, don't clear out the
DeclContext because we don't want a NULL DeclContext. Instead, use the
current context.
llvm-svn: 99281
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index aaf39ef..bf92ef8 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -2131,7 +2131,8 @@
<< D.getCXXScopeSpec().getRange();
D.setInvalidType();
// Pretend we didn't see the scope specifier.
- DC = 0;
+ DC = CurContext;
+ Previous.clear();
}
if (getLangOptions().CPlusPlus) {
diff --git a/clang/test/SemaCXX/qual-id-test.cpp b/clang/test/SemaCXX/qual-id-test.cpp
index 54d41b8..4846e72 100644
--- a/clang/test/SemaCXX/qual-id-test.cpp
+++ b/clang/test/SemaCXX/qual-id-test.cpp
@@ -138,3 +138,12 @@
a a;
int a::sa = a.a; // expected-error {{invalid use of nonstatic data member 'a'}}
+
+
+namespace PR6645 {
+ typedef int foo;
+ namespace Inner {
+ typedef int PR6645::foo; // expected-error{{typedef declarator cannot be qualified}} \
+ // expected-error{{definition or redeclaration of 'foo' not in a namespace enclosing 'PR6645'}}
+ }
+}