[cfe-commits] r95359 - in /cfe/trunk: lib/Sema/SemaCXXScopeSpec.cpp test/SemaTemplate/typename-specifier-4.cpp

Douglas Gregor dgregor at apple.com
Thu Feb 4 20:39:03 PST 2010


Author: dgregor
Date: Thu Feb  4 22:39:02 2010
New Revision: 95359

URL: http://llvm.org/viewvc/llvm-project?rev=95359&view=rev
Log:
When determining whether a scope specifier is complete, consider a
dependent DeclContext to be "complete". Fixes PR6236.

Modified:
    cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp
    cfe/trunk/test/SemaTemplate/typename-specifier-4.cpp

Modified: cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp?rev=95359&r1=95358&r2=95359&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp Thu Feb  4 22:39:02 2010
@@ -241,6 +241,10 @@
 
   DeclContext *DC = computeDeclContext(SS, true);
   if (TagDecl *Tag = dyn_cast<TagDecl>(DC)) {
+    // If this is a dependent type, then we consider it complete.
+    if (Tag->isDependentContext())
+      return false;
+
     // If we're currently defining this type, then lookup into the
     // type is okay: don't complain that it isn't complete yet.
     const TagType *TagT = Context.getTypeDeclType(Tag)->getAs<TagType>();

Modified: cfe/trunk/test/SemaTemplate/typename-specifier-4.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/typename-specifier-4.cpp?rev=95359&r1=95358&r2=95359&view=diff

==============================================================================
--- cfe/trunk/test/SemaTemplate/typename-specifier-4.cpp (original)
+++ cfe/trunk/test/SemaTemplate/typename-specifier-4.cpp Thu Feb  4 22:39:02 2010
@@ -68,3 +68,15 @@
   void f2(typename X0<T>::Inner<T*, T&>::type); // expected-note{{here}}
   void f2(typename X0<T>::template Inner<T*, T&>::type); // expected-error{{redecl}}
 };
+
+namespace PR6236 {
+  template<typename T, typename U> struct S { };
+  
+  template<typename T> struct S<T, T> {
+    template<typename U> struct K { };
+    
+    void f() {
+      typedef typename S<T, T>::template K<T> Foo;
+    }
+  };
+}





More information about the cfe-commits mailing list