@@ -11702,6 +11702,7 @@ grokparms (tree parmlist, tree *parms)
/* Top-level qualifiers on the parameters are
ignored for function types. */
type = strip_top_quals (type);
+ type = type_decays_to (type);
if (TREE_CODE (type) == METHOD_TYPE)
{
@@ -11740,6 +11740,10 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
complain, t);
DECL_RESULT (r) = NULL_TREE;
+ for (tree parm = DECL_ARGUMENTS (r); parm; parm = DECL_CHAIN (parm))
+ if (TREE_TYPE (parm) == error_mark_node)
+ RETURN (error_mark_node);
+
TREE_STATIC (r) = 0;
TREE_PUBLIC (r) = TREE_PUBLIC (t);
DECL_EXTERNAL (r) = 1;
@@ -17742,23 +17746,6 @@ fn_type_unification (tree fn,
return r;
}
-/* TYPE is the type of a function parameter. If TYPE is a (dependent)
- ARRAY_TYPE, return the corresponding POINTER_TYPE to which it decays.
- Otherwise return TYPE. (We shouldn't see non-dependent ARRAY_TYPE
- parameters because they get decayed as soon as they are declared.) */
-
-static tree
-decay_dependent_array_parm_type (tree type)
-{
- if (TREE_CODE (type) == ARRAY_TYPE)
- {
- gcc_assert (uses_template_parms (type));
- return type_decays_to (type);
- }
-
- return type;
-}
-
/* Adjust types before performing type deduction, as described in
[temp.deduct.call] and [temp.deduct.conv]. The rules in these two
sections are symmetric. PARM is the type of a function parameter
@@ -18197,8 +18184,6 @@ type_unification_real (tree tparms,
arg = args[ia];
++ia;
- parm = decay_dependent_array_parm_type (parm);
-
if (unify_one_argument (tparms, targs, parm, arg, subr, strict,
explain_p))
return 1;
@@ -20232,9 +20217,6 @@ more_specialized_fn (tree pat1, tree pat2, int len)
len = 0;
}
- arg1 = decay_dependent_array_parm_type (arg1);
- arg2 = decay_dependent_array_parm_type (arg2);
-
if (TREE_CODE (arg1) == REFERENCE_TYPE)
{
ref1 = TYPE_REF_IS_RVALUE (arg1) + 1;
@@ -20520,10 +20502,7 @@ get_bindings (tree fn, tree decl, tree explicit_args, bool check_rettype)
for (arg = decl_arg_types, ix = 0;
arg != NULL_TREE && arg != void_list_node;
arg = TREE_CHAIN (arg), ++ix)
- {
- args[ix] = TREE_VALUE (arg);
- args[ix] = decay_dependent_array_parm_type (args[ix]);
- }
+ args[ix] = TREE_VALUE (arg);
if (fn_type_unification (fn, explicit_args, targs,
args, ix,
new file mode 100644
@@ -0,0 +1,22 @@
+template <typename T, int I>
+int foo (T [I]);
+
+template <typename T>
+int bar (T [7]);
+
+template <int I>
+int baz (int [I]);
+
+extern int x, y, z;
+
+int
+main ()
+{
+ x = foo<int, 5> (0);
+ y = bar<char> (0);
+ z = baz<9> (0);
+}
+
+// { dg-final { scan-assembler "_Z3fooIiLi5EEiPT_" } }
+// { dg-final { scan-assembler "_Z3barIcEiPT_" } }
+// { dg-final { scan-assembler "_Z3bazILi9EEiPi" } }
@@ -1,11 +1,11 @@
void foo (int *);
template <typename T>
-void bar (void (T[5])); // { dg-error "array of 'void'" }
+void bar (void (T[5])); // { dg-error "array of 'void'" "" { xfail *-*-* } }
void
baz (void)
{
bar (foo); // { dg-bogus "" }
- bar<void> (0); // { dg-error "no matching function" }
+ bar<void> (0); // { dg-error "no matching function" "" { xfail *-*-* } }
}