[cfe-commits] r99281 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/SemaCXX/qual-id-test.cpp

Douglas Gregor dgregor at apple.com
Tue Mar 23 08:26:55 PDT 2010


Author: dgregor
Date: Tue Mar 23 10:26:55 2010
New Revision: 99281

URL: http://llvm.org/viewvc/llvm-project?rev=99281&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/test/SemaCXX/qual-id-test.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=99281&r1=99280&r2=99281&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Mar 23 10:26:55 2010
@@ -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) {

Modified: cfe/trunk/test/SemaCXX/qual-id-test.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/qual-id-test.cpp?rev=99281&r1=99280&r2=99281&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/qual-id-test.cpp (original)
+++ cfe/trunk/test/SemaCXX/qual-id-test.cpp Tue Mar 23 10:26:55 2010
@@ -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'}}
+  }
+}





More information about the cfe-commits mailing list