diff options
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 3 | ||||
-rw-r--r-- | test/SemaCXX/qual-id-test.cpp | 9 |
2 files changed, 11 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index aaf39ef1f9..bf92ef829b 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -2131,7 +2131,8 @@ Sema::ActOnTypedefDeclarator(Scope* S, Declarator& D, DeclContext* DC, << 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/test/SemaCXX/qual-id-test.cpp b/test/SemaCXX/qual-id-test.cpp index 54d41b81ca..4846e72e59 100644 --- a/test/SemaCXX/qual-id-test.cpp +++ b/test/SemaCXX/qual-id-test.cpp @@ -138,3 +138,12 @@ struct a { 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'}} + } +} |