]> granicus.if.org Git - clang/commitdiff
When determining whether a scope specifier is complete, consider a
authorDouglas Gregor <dgregor@apple.com>
Fri, 5 Feb 2010 04:39:02 +0000 (04:39 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 5 Feb 2010 04:39:02 +0000 (04:39 +0000)
dependent DeclContext to be "complete". Fixes PR6236.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95359 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaCXXScopeSpec.cpp
test/SemaTemplate/typename-specifier-4.cpp

index 7a0b6252064dba90b81085d2f115c7756719adf3..52e9e9bc87ef2f10982ebc7a97775fb5010214d4 100644 (file)
@@ -241,6 +241,10 @@ bool Sema::RequireCompleteDeclContext(const CXXScopeSpec &SS) {
 
   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>();
index 7fd88f130fa62f6bc90dc4e20d151c7e0a08cbb8..9c757c5ad0fd59018fedb959aa36b97614d51137 100644 (file)
@@ -68,3 +68,15 @@ struct X0 {
   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;
+    }
+  };
+}