vec<deferred_access_check, va_gc> **,
bool);
static void note_template_header (int);
-static tree convert_nontype_argument_function (tree, tree);
+static tree convert_nontype_argument_function (tree, tree, tsubst_flags_t);
static tree convert_nontype_argument (tree, tree, tsubst_flags_t);
static tree convert_template_argument (tree, tree, tree,
tsubst_flags_t, int, tree);
and check that the resulting function has external linkage. */
static tree
-convert_nontype_argument_function (tree type, tree expr)
+convert_nontype_argument_function (tree type, tree expr,
+ tsubst_flags_t complain)
{
tree fns = expr;
tree fn, fn_no_ptr;
if (TREE_CODE (fn_no_ptr) != FUNCTION_DECL)
{
- error ("%qE is not a valid template argument for type %qT", expr, type);
- if (TYPE_PTR_P (type))
- error ("it must be the address of a function with external linkage");
- else
- error ("it must be the name of a function with external linkage");
+ if (complain & tf_error)
+ {
+ error ("%qE is not a valid template argument for type %qT",
+ expr, type);
+ if (TYPE_PTR_P (type))
+ error ("it must be the address of a function with "
+ "external linkage");
+ else
+ error ("it must be the name of a function with "
+ "external linkage");
+ }
return NULL_TREE;
}
linkage = decl_linkage (fn_no_ptr);
if (cxx_dialect >= cxx11 ? linkage == lk_none : linkage != lk_external)
{
- if (cxx_dialect >= cxx11)
- error ("%qE is not a valid template argument for type %qT "
- "because %qD has no linkage",
- expr, type, fn_no_ptr);
- else
- error ("%qE is not a valid template argument for type %qT "
- "because %qD does not have external linkage",
- expr, type, fn_no_ptr);
+ if (complain & tf_error)
+ {
+ if (cxx_dialect >= cxx11)
+ error ("%qE is not a valid template argument for type %qT "
+ "because %qD has no linkage",
+ expr, type, fn_no_ptr);
+ else
+ error ("%qE is not a valid template argument for type %qT "
+ "because %qD does not have external linkage",
+ expr, type, fn_no_ptr);
+ }
return NULL_TREE;
}
/* Null pointer values are OK in C++11. */
return perform_qualification_conversions (type, expr);
- expr = convert_nontype_argument_function (type, expr);
+ expr = convert_nontype_argument_function (type, expr, complain);
if (!expr || expr == error_mark_node)
return expr;
}
return NULL_TREE;
}
- expr = convert_nontype_argument_function (type, expr);
+ expr = convert_nontype_argument_function (type, expr, complain);
if (!expr || expr == error_mark_node)
return expr;
if (arg_idx - parm_idx < TREE_VEC_LENGTH (packed_args)
&& TREE_VEC_LENGTH (packed_args) > 0)
{
- error ("wrong number of template arguments (%d, should be %d)",
- arg_idx - parm_idx, TREE_VEC_LENGTH (packed_args));
+ if (complain & tf_error)
+ error ("wrong number of template arguments (%d, should be %d)",
+ arg_idx - parm_idx, TREE_VEC_LENGTH (packed_args));
return error_mark_node;
}