&depth, NULL, /*include_nondeduced_p=*/true))
return true;
if (PRIMARY_TEMPLATE_P (decl)
- && for_each_template_parm (INNERMOST_TEMPLATE_PARMS
- (DECL_TEMPLATE_PARMS (decl)),
- template_parm_outer_level,
- &depth, NULL, /*include_nondeduced_p=*/true))
- return true;
+ || DECL_TEMPLATE_TEMPLATE_PARM_P (decl))
+ {
+ tree parms = INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (decl));
+ for (int i = TREE_VEC_LENGTH (parms) - 1; i >= 0; --i)
+ {
+ tree parm = TREE_VALUE (TREE_VEC_ELT (parms, i));
+ if (TREE_CODE (parm) == PARM_DECL
+ && for_each_template_parm (TREE_TYPE (parm),
+ template_parm_outer_level,
+ &depth, NULL, /*nondeduced*/true))
+ return true;
+ if (TREE_CODE (parm) == TEMPLATE_DECL
+ && uses_outer_template_parms (parm))
+ return true;
+ }
+ }
tree ci = get_constraints (decl);
if (ci)
ci = CI_ASSOCIATED_CONSTRAINTS (ci);
--- /dev/null
+// PR c++/93085
+// { dg-do compile { target c++11 } }
+
+template<class T>
+struct G {
+ template<T> static int foo(); // #1
+ template<int> static int foo(); // #2
+ int x = foo<42>(); // OK
+};