extern tree resolve_nondeduced_context (tree, tsubst_flags_t);
extern tree resolve_nondeduced_context_or_error (tree, tsubst_flags_t);
extern hashval_t iterative_hash_template_arg (tree arg, hashval_t val);
- extern tree coerce_template_parms (tree, tree, tree);
- extern tree coerce_template_parms (tree, tree, tree, tsubst_flags_t);
+ extern tree coerce_template_parms (tree, tree, tree, tsubst_flags_t,
+ bool = true);
extern tree canonicalize_type_argument (tree, tsubst_flags_t);
+extern void register_local_identity (tree);
extern void register_local_specialization (tree, tree);
extern tree retrieve_local_specialization (tree);
+extern void register_parameter_specializations (tree, tree);
extern tree extract_fnparm_pack (tree, tree *);
extern tree template_parm_to_arg (tree);
extern tree dguide_name (tree);
if (processing_template_decl)
return saved_retval;
+ /* A naive attempt to reduce the number of -Wdangling-reference false
+ positives: if we know that this function can return a variable with
+ static storage duration rather than one of its parameters, suppress
+ the warning. */
+ if (warn_dangling_reference
+ && TYPE_REF_P (functype)
+ && bare_retval
+ && VAR_P (bare_retval)
+ && TREE_STATIC (bare_retval))
+ suppress_warning (current_function_decl, OPT_Wdangling_reference);
+
/* Actually copy the value returned into the appropriate location. */
if (retval && retval != result)
- retval = cp_build_init_expr (result, retval);
+ {
+ /* If there's a postcondition for a scalar return value, wrap
+ retval in a call to the postcondition function. */
+ if (tree post = apply_postcondition_to_return (retval))
+ retval = post;
+ retval = cp_build_init_expr (result, retval);
+ }
if (tree set = maybe_set_retval_sentinel ())
retval = build2 (COMPOUND_EXPR, void_type_node, retval, set);