/* We haven't deduced the type of this parameter yet. */
if (cxx_dialect >= cxx17
/* We deduce from array bounds in try_array_deduction. */
- && !(strict & UNIFY_ALLOW_INTEGER))
+ && !(strict & UNIFY_ALLOW_INTEGER)
+ && TEMPLATE_PARM_LEVEL (parm) <= TMPL_ARGS_DEPTH (targs))
{
/* Deduce it from the non-type argument. */
tree atype = TREE_TYPE (arg);
RECUR_AND_CHECK_FAILURE (tparms, targs,
tparm, atype,
UNIFY_ALLOW_NONE, explain_p);
+ /* Now check whether the type of this parameter is still
+ dependent, and give up if so. */
+ ++processing_template_decl;
+ tparm = tsubst (tparm, targs, tf_none, NULL_TREE);
+ --processing_template_decl;
+ if (uses_template_parms (tparm))
+ return unify_success (explain_p);
}
else
/* Try again later. */
--- /dev/null
+// { dg-do compile { target c++11 } }
+
+template <int> struct K { };
+
+template <class T = void, typename T::type M> int f(K<M>); // { dg-error "void" }
+int a = f(K<42>{}); // { dg-error "no match" }
+
+struct S { using type = void; };
+template <class T = S, typename T::type M> int g(K<M>); // { dg-message "deduction" }
+int b = g(K<42>{}); // { dg-error "no match" }
--- /dev/null
+// { dg-do compile { target c++11 } }
+
+template <int> struct K { };
+
+struct S { using type = int; };
+template <class T = S, typename T::type M> int g(K<M>);
+int a = g(K<42>{});
struct Y { };
template<typename T, typename U, U v>
-struct Y<T, v> { }; // { dg-error "" "" { target { ! c++17 } } }
+struct Y<T, v> { }; // { dg-error "" }
template<typename T, T V>
--- /dev/null
+// A slight variation of ttp31.C.
+// { dg-do compile { target c++11 } }
+
+template<class TA,
+ template<typename TA::type...> class TTA, TA... VA>
+struct A { };
+
+template<class UC, class TC,
+ template<typename TC::type...> class TTC, TC... VC>
+struct C : A<TC, TTC, VC...> { };