More for PR11848: a pack expansion type isn't necessarily type-dependent (its
pattern might be an alias template which doesn't use its arguments). It's always
instantiation-dependent, though.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160246 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h
index ff27200..fbb3a58 100644
--- a/include/clang/AST/Type.h
+++ b/include/clang/AST/Type.h
@@ -4105,7 +4105,7 @@
 
   PackExpansionType(QualType Pattern, QualType Canon,
                     llvm::Optional<unsigned> NumExpansions)
-    : Type(PackExpansion, Canon, /*Dependent=*/true,
+    : Type(PackExpansion, Canon, /*Dependent=*/Pattern->isDependentType(),
            /*InstantiationDependent=*/true,
            /*VariableModified=*/Pattern->isVariablyModifiedType(),
            /*ContainsUnexpandedParameterPack=*/false),
diff --git a/test/SemaTemplate/alias-templates.cpp b/test/SemaTemplate/alias-templates.cpp
index a3d66ae..20ba6e0 100644
--- a/test/SemaTemplate/alias-templates.cpp
+++ b/test/SemaTemplate/alias-templates.cpp
@@ -125,17 +125,17 @@
   void h(...);
   template<typename T> using Y = X;
   template<typename T, typename ...Ts> struct S {
+    // An expression can contain an unexpanded pack without being type or
+    // value dependent. This is true even if the expression's type is a pack
+    // expansion type.
     void f1(Y<T> a) { h(g(a)); } // expected-error {{undeclared identifier 'g'}}
-    // FIXME: We should reject this too: 'as' has non-dependent type 'X', so
-    //        ADL should be performed at the point of definition of the
-    //        template.
-    void f2(Y<Ts>...as) { h(g(as)...); }
+    void f2(Y<Ts>...as) { h(g(as)...); } // expected-error {{undeclared identifier 'g'}}
+    void f3(Y<Ts>...as) { g(as...); } // ok
+    void f4(Ts ...ts) { h(g(sizeof(ts))...); } // expected-error {{undeclared identifier 'g'}}
+    // FIXME: We can reject this, since it has no valid instantiations because
+    // 'g' never has any associated namespaces.
+    void f5(Ts ...ts) { g(sizeof(ts)...); } // ok
   };
-  int g(X);
-  void test() {
-    S<int, int>().f1({});
-    S<int, int>().f2({});
-  }
 }
 
 namespace PR13243 {