c++: remove '_sfinae' suffix from functions

Message ID 20220909125202.1314938-1-ppalka@redhat.com
State Accepted
Headers
Series c++: remove '_sfinae' suffix from functions |

Commit Message

Patrick Palka Sept. 9, 2022, 12:52 p.m. UTC
  Each of the following functions

  instantiate_non_dependent_expr
  get_target_expr
  require_complete_type
  abstract_virtuals_error
  cxx_constant_value

is (presumably for historical reasons) just a non-SFINAE-enabled wrapper
for the corresponding SFINAE-enabled version that's suffixed by '_sfinae'.
But this suffix is at best redundant since a 'complain' parameter already
conveys that a function is appropriately SFINAE-enabled, and having two
such versions of a function is cluttersome compared to just using a default
argument (and also no less error prone I think).

So this patch squashes the two versions of each of the above functions
by adding a default 'complain' argument to the SFINAE-enabled version
whose '_sfinae' suffix we then remove.

Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for
trunk?

gcc/cp/ChangeLog:

	* all.cc (build_conditional_expr): Adjust calls to
	'_sfinae'-suffixed functions.
	(build_temp): Likewise.
	(convert_like_internal): Likewise.
	(convert_arg_to_ellipsis): Likewise.
	(build_over_call): Likewise.
	(build_cxx_call): Likewise.
	(build_new_method_call): Likewise.
	* constexpr.cc (cxx_eval_outermost_constant_expr): Likewise.
	(cxx_constant_value_sfinae): Rename to ...
	(cxx_constant_value): ... this.  Document its default arguments.
	(fold_non_dependent_expr): Adjust function comment.
	* cp-tree.h (instantiate_non_dependent_expr_sfinae): Rename to ...
	(instantiate_non_dependent_expr): ... this.  Give its 'complain'
	parameter a default argument.
	(get_target_expr_sfinae, get_target_expr): Likewise.
	(require_complete_type_sfinae, require_complete_type): Likewise.
	(abstract_virtuals_error_sfinae, abstract_virtuals_error):
	Likewise.
	(cxx_constant_value_sfinae, cxx_constant_value): Likewise.
	* cvt.cc (build_up_reference): Adjust calls to '_sfinae'-suffixed
	functions.
	(ocp_convert): Likewise.
	* decl.cc (build_explicit_specifier): Likewise.
	* except.cc (build_noexcept_spec): Likewise.
	* init.cc (build_new_1): Likewise.
	* pt.cc (expand_integer_pack): Likewise.
	(instantiate_non_dependent_expr_internal): Adjust function
	comment.
	(instantiate_non_dependent_expr): Rename to ...
	(instantiate_non_dependent_expr_sfinae): ... this.  Document its
	default argument.
	(tsubst_init): Adjust calls to '_sfinae'-suffixed functions.
	(fold_targs_r): Likewise.
	* semantics.cc (finish_compound_literal): Likewise.
	(finish_decltype_type): Likewise.
	(cp_build_bit_cast): Likewise.
	* tree.cc (build_cplus_new): Likewise.
	(get_target_expr): Rename to ...
	(get_target_expr_sfinae): ... this.  Document its default
	argument.
	* typeck.cc (require_complete_type): Rename to ...
	(require_complete_type_sfinae): ... this.  Document its default
	argument.
	(cp_build_array_ref): Adjust calls to '_sfinae'-suffixed
	functions.
	(convert_arguments): Likewise.
	(cp_build_binary_op): Likewise.
	(build_static_cast_1): Likewise.
	(cp_build_modify_expr): Likewise.
	(convert_for_initialization): Likewise.
	* typeck2.cc (abstract_virtuals_error): Rename to ...
	(abstract_virtuals_error_sfinae): ... this. Document its default
	argument.
	(build_functional_cast_1): Adjust calls to '_sfinae'-suffixed
	functions.
---
 gcc/cp/call.cc      | 22 +++++++++++-----------
 gcc/cp/constexpr.cc | 20 ++++++--------------
 gcc/cp/cp-tree.h    | 23 +++++++++++------------
 gcc/cp/cvt.cc       |  4 ++--
 gcc/cp/decl.cc      |  2 +-
 gcc/cp/except.cc    |  2 +-
 gcc/cp/init.cc      |  2 +-
 gcc/cp/pt.cc        | 17 ++++++-----------
 gcc/cp/semantics.cc |  6 +++---
 gcc/cp/tree.cc      | 10 ++--------
 gcc/cp/typeck.cc    | 21 ++++++++-------------
 gcc/cp/typeck2.cc   | 33 ++++++++++-----------------------
 12 files changed, 62 insertions(+), 100 deletions(-)
  

Comments

Jason Merrill Sept. 12, 2022, 7:52 p.m. UTC | #1
On 9/9/22 08:52, Patrick Palka wrote:
> Each of the following functions
> 
>    instantiate_non_dependent_expr
>    get_target_expr
>    require_complete_type
>    abstract_virtuals_error
>    cxx_constant_value
> 
> is (presumably for historical reasons) just a non-SFINAE-enabled wrapper
> for the corresponding SFINAE-enabled version that's suffixed by '_sfinae'.
> But this suffix is at best redundant since a 'complain' parameter already
> conveys that a function is appropriately SFINAE-enabled, and having two
> such versions of a function is cluttersome compared to just using a default
> argument (and also no less error prone I think).
> 
> So this patch squashes the two versions of each of the above functions
> by adding a default 'complain' argument to the SFINAE-enabled version
> whose '_sfinae' suffix we then remove.
> 
> Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for
> trunk?

OK.

> gcc/cp/ChangeLog:
> 
> 	* all.cc (build_conditional_expr): Adjust calls to
> 	'_sfinae'-suffixed functions.
> 	(build_temp): Likewise.
> 	(convert_like_internal): Likewise.
> 	(convert_arg_to_ellipsis): Likewise.
> 	(build_over_call): Likewise.
> 	(build_cxx_call): Likewise.
> 	(build_new_method_call): Likewise.
> 	* constexpr.cc (cxx_eval_outermost_constant_expr): Likewise.
> 	(cxx_constant_value_sfinae): Rename to ...
> 	(cxx_constant_value): ... this.  Document its default arguments.
> 	(fold_non_dependent_expr): Adjust function comment.
> 	* cp-tree.h (instantiate_non_dependent_expr_sfinae): Rename to ...
> 	(instantiate_non_dependent_expr): ... this.  Give its 'complain'
> 	parameter a default argument.
> 	(get_target_expr_sfinae, get_target_expr): Likewise.
> 	(require_complete_type_sfinae, require_complete_type): Likewise.
> 	(abstract_virtuals_error_sfinae, abstract_virtuals_error):
> 	Likewise.
> 	(cxx_constant_value_sfinae, cxx_constant_value): Likewise.
> 	* cvt.cc (build_up_reference): Adjust calls to '_sfinae'-suffixed
> 	functions.
> 	(ocp_convert): Likewise.
> 	* decl.cc (build_explicit_specifier): Likewise.
> 	* except.cc (build_noexcept_spec): Likewise.
> 	* init.cc (build_new_1): Likewise.
> 	* pt.cc (expand_integer_pack): Likewise.
> 	(instantiate_non_dependent_expr_internal): Adjust function
> 	comment.
> 	(instantiate_non_dependent_expr): Rename to ...
> 	(instantiate_non_dependent_expr_sfinae): ... this.  Document its
> 	default argument.
> 	(tsubst_init): Adjust calls to '_sfinae'-suffixed functions.
> 	(fold_targs_r): Likewise.
> 	* semantics.cc (finish_compound_literal): Likewise.
> 	(finish_decltype_type): Likewise.
> 	(cp_build_bit_cast): Likewise.
> 	* tree.cc (build_cplus_new): Likewise.
> 	(get_target_expr): Rename to ...
> 	(get_target_expr_sfinae): ... this.  Document its default
> 	argument.
> 	* typeck.cc (require_complete_type): Rename to ...
> 	(require_complete_type_sfinae): ... this.  Document its default
> 	argument.
> 	(cp_build_array_ref): Adjust calls to '_sfinae'-suffixed
> 	functions.
> 	(convert_arguments): Likewise.
> 	(cp_build_binary_op): Likewise.
> 	(build_static_cast_1): Likewise.
> 	(cp_build_modify_expr): Likewise.
> 	(convert_for_initialization): Likewise.
> 	* typeck2.cc (abstract_virtuals_error): Rename to ...
> 	(abstract_virtuals_error_sfinae): ... this. Document its default
> 	argument.
> 	(build_functional_cast_1): Adjust calls to '_sfinae'-suffixed
> 	functions.
> ---
>   gcc/cp/call.cc      | 22 +++++++++++-----------
>   gcc/cp/constexpr.cc | 20 ++++++--------------
>   gcc/cp/cp-tree.h    | 23 +++++++++++------------
>   gcc/cp/cvt.cc       |  4 ++--
>   gcc/cp/decl.cc      |  2 +-
>   gcc/cp/except.cc    |  2 +-
>   gcc/cp/init.cc      |  2 +-
>   gcc/cp/pt.cc        | 17 ++++++-----------
>   gcc/cp/semantics.cc |  6 +++---
>   gcc/cp/tree.cc      | 10 ++--------
>   gcc/cp/typeck.cc    | 21 ++++++++-------------
>   gcc/cp/typeck2.cc   | 33 ++++++++++-----------------------
>   12 files changed, 62 insertions(+), 100 deletions(-)
> 
> diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc
> index d107a2814dc..7e9289fc2d0 100644
> --- a/gcc/cp/call.cc
> +++ b/gcc/cp/call.cc
> @@ -5976,7 +5976,7 @@ build_conditional_expr (const op_location_t &loc,
>   	 but now we sometimes wrap them in NOP_EXPRs so the test would
>   	 fail.  */
>         if (CLASS_TYPE_P (TREE_TYPE (result)))
> -	result = get_target_expr_sfinae (result, complain);
> +	result = get_target_expr (result, complain);
>         /* If this expression is an rvalue, but might be mistaken for an
>   	 lvalue, we must add a NON_LVALUE_EXPR.  */
>         result = rvalue (result);
> @@ -7672,7 +7672,7 @@ build_temp (tree expr, tree type, int flags,
>     if ((lvalue_kind (expr) & clk_packed)
>         && CLASS_TYPE_P (TREE_TYPE (expr))
>         && !type_has_nontrivial_copy_init (TREE_TYPE (expr)))
> -    return get_target_expr_sfinae (expr, complain);
> +    return get_target_expr (expr, complain);
>   
>     /* In decltype, we might have decided not to wrap this call in a TARGET_EXPR.
>        But it turns out to be a subexpression, so perform temporary
> @@ -8008,10 +8008,10 @@ convert_like_internal (conversion *convs, tree expr, tree fn, int argnum,
>   	    && !processing_template_decl)
>   	  {
>   	    bool direct = CONSTRUCTOR_IS_DIRECT_INIT (expr);
> -	    if (abstract_virtuals_error_sfinae (NULL_TREE, totype, complain))
> +	    if (abstract_virtuals_error (NULL_TREE, totype, complain))
>   	      return error_mark_node;
>   	    expr = build_value_init (totype, complain);
> -	    expr = get_target_expr_sfinae (expr, complain);
> +	    expr = get_target_expr (expr, complain);
>   	    if (expr != error_mark_node)
>   	      {
>   		TARGET_EXPR_LIST_INIT_P (expr) = true;
> @@ -8137,7 +8137,7 @@ convert_like_internal (conversion *convs, tree expr, tree fn, int argnum,
>   	field = next_aggregate_field (DECL_CHAIN (field));
>   	CONSTRUCTOR_APPEND_ELT (vec, field, size_int (len));
>   	tree new_ctor = build_constructor (totype, vec);
> -	return get_target_expr_sfinae (new_ctor, complain);
> +	return get_target_expr (new_ctor, complain);
>         }
>   
>       case ck_aggr:
> @@ -8153,7 +8153,7 @@ convert_like_internal (conversion *convs, tree expr, tree fn, int argnum,
>   	  return expr;
>   	}
>         expr = reshape_init (totype, expr, complain);
> -      expr = get_target_expr_sfinae (digest_init (totype, expr, complain),
> +      expr = get_target_expr (digest_init (totype, expr, complain),
>   				     complain);
>         if (expr != error_mark_node)
>   	TARGET_EXPR_LIST_INIT_P (expr) = true;
> @@ -8580,12 +8580,12 @@ convert_arg_to_ellipsis (tree arg, tsubst_flags_t complain)
>          standard conversions are performed.  */
>       arg = decay_conversion (arg, complain);
>   
> -  arg = require_complete_type_sfinae (arg, complain);
> +  arg = require_complete_type (arg, complain);
>     arg_type = TREE_TYPE (arg);
>   
>     if (arg != error_mark_node
>         /* In a template (or ill-formed code), we can have an incomplete type
> -	 even after require_complete_type_sfinae, in which case we don't know
> +	 even after require_complete_type, in which case we don't know
>   	 whether it has trivial copy or not.  */
>         && COMPLETE_TYPE_P (arg_type)
>         && !cp_unevaluated_operand)
> @@ -10000,7 +10000,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
>   		    obj_arg = TREE_OPERAND (addr, 0);
>   		}
>   	    }
> -	  call = cxx_constant_value_sfinae (call, obj_arg, complain);
> +	  call = cxx_constant_value (call, obj_arg, complain);
>   	  if (obj_arg && !error_operand_p (call))
>   	    call = build2 (INIT_EXPR, void_type_node, obj_arg, call);
>   	  call = convert_from_reference (call);
> @@ -10505,7 +10505,7 @@ build_cxx_call (tree fn, int nargs, tree *argarray,
>        prvalue. The type of the prvalue may be incomplete.  */
>     if (!(complain & tf_decltype))
>       {
> -      fn = require_complete_type_sfinae (fn, complain);
> +      fn = require_complete_type (fn, complain);
>         if (fn == error_mark_node)
>   	return error_mark_node;
>   
> @@ -11084,7 +11084,7 @@ build_new_method_call (tree instance, tree fns, vec<tree, va_gc> **args,
>         if (init)
>   	{
>   	  if (is_dummy_object (instance))
> -	    return get_target_expr_sfinae (init, complain);
> +	    return get_target_expr (init, complain);
>   	  init = build2 (INIT_EXPR, TREE_TYPE (instance), instance, init);
>   	  TREE_SIDE_EFFECTS (init) = true;
>   	  return init;
> diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
> index c047fe4a2a1..57283eabf3c 100644
> --- a/gcc/cp/constexpr.cc
> +++ b/gcc/cp/constexpr.cc
> @@ -8068,7 +8068,7 @@ cxx_eval_outermost_constant_expr (tree t, bool allow_non_constant,
>   	r = get_target_expr (r);
>         else
>   	{
> -	  r = get_target_expr_sfinae (r, tf_warning_or_error | tf_no_cleanup);
> +	  r = get_target_expr (r, tf_warning_or_error | tf_no_cleanup);
>   	  TREE_CONSTANT (r) = true;
>   	}
>       }
> @@ -8081,19 +8081,11 @@ cxx_eval_outermost_constant_expr (tree t, bool allow_non_constant,
>   }
>   
>   /* If T represents a constant expression returns its reduced value.
> -   Otherwise return error_mark_node.  If T is dependent, then
> -   return NULL.  */
> +   Otherwise return error_mark_node.  */
>   
>   tree
> -cxx_constant_value (tree t, tree decl)
> -{
> -  return cxx_eval_outermost_constant_expr (t, false, true, true, false, decl);
> -}
> -
> -/* As above, but respect SFINAE.  */
> -
> -tree
> -cxx_constant_value_sfinae (tree t, tree decl, tsubst_flags_t complain)
> +cxx_constant_value (tree t, tree decl /* = NULL_TREE */,
> +		    tsubst_flags_t complain /* = tf_error */)
>   {
>     bool sfinae = !(complain & tf_error);
>     tree r = cxx_eval_outermost_constant_expr (t, sfinae, true, true, false, decl);
> @@ -8316,8 +8308,8 @@ fold_non_dependent_expr_template (tree t, tsubst_flags_t complain,
>   
>   /* Like maybe_constant_value but first fully instantiate the argument.
>   
> -   Note: this is equivalent to instantiate_non_dependent_expr_sfinae
> -   (t, complain) followed by maybe_constant_value but is more efficient,
> +   Note: this is equivalent to instantiate_non_dependent_expr (t, complain)
> +   followed by maybe_constant_value but is more efficient,
>      because it calls instantiation_dependent_expression_p and
>      potential_constant_expression at most once.
>      The manifestly_const_eval argument is passed to maybe_constant_value.
> diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
> index 6648e5b5fde..aa16c0fe6a2 100644
> --- a/gcc/cp/cp-tree.h
> +++ b/gcc/cp/cp-tree.h
> @@ -7390,8 +7390,7 @@ extern tree template_for_substitution		(tree);
>   extern tree build_non_dependent_expr		(tree);
>   extern void make_args_non_dependent		(vec<tree, va_gc> *);
>   extern bool reregister_specialization		(tree, tree, tree);
> -extern tree instantiate_non_dependent_expr	(tree);
> -extern tree instantiate_non_dependent_expr_sfinae (tree, tsubst_flags_t);
> +extern tree instantiate_non_dependent_expr	(tree, tsubst_flags_t = tf_error);
>   extern tree instantiate_non_dependent_expr_internal (tree, tsubst_flags_t);
>   extern tree instantiate_non_dependent_or_null   (tree);
>   extern bool variable_template_specialization_p  (tree);
> @@ -7823,8 +7822,8 @@ extern tree build_cplus_new			(tree, tree, tsubst_flags_t);
>   extern tree build_local_temp			(tree);
>   extern bool is_local_temp			(tree);
>   extern tree build_aggr_init_expr		(tree, tree);
> -extern tree get_target_expr			(tree);
> -extern tree get_target_expr_sfinae		(tree, tsubst_flags_t);
> +extern tree get_target_expr			(tree,
> +						 tsubst_flags_t = tf_warning_or_error);
>   extern tree build_cplus_array_type		(tree, tree, int is_dep = -1);
>   extern tree build_array_of_n_type		(tree, int);
>   extern bool array_of_runtime_bound_p		(tree);
> @@ -7936,8 +7935,8 @@ extern int string_conv_p			(const_tree, const_tree, int);
>   extern tree cp_truthvalue_conversion		(tree, tsubst_flags_t);
>   extern tree contextual_conv_bool		(tree, tsubst_flags_t);
>   extern tree condition_conversion		(tree);
> -extern tree require_complete_type		(tree);
> -extern tree require_complete_type_sfinae	(tree, tsubst_flags_t);
> +extern tree require_complete_type		(tree,
> +						 tsubst_flags_t = tf_warning_or_error);
>   extern tree complete_type			(tree);
>   extern tree complete_type_or_else		(tree, tree);
>   extern tree complete_type_or_maybe_complain	(tree, tree, tsubst_flags_t);
> @@ -8151,10 +8150,10 @@ extern tree binfo_or_else			(tree, tree);
>   extern void cxx_readonly_error			(location_t, tree,
>   						 enum lvalue_use);
>   extern void complete_type_check_abstract	(tree);
> -extern int abstract_virtuals_error		(tree, tree);
> -extern int abstract_virtuals_error		(abstract_class_use, tree);
> -extern int abstract_virtuals_error_sfinae	(tree, tree, tsubst_flags_t);
> -extern int abstract_virtuals_error_sfinae	(abstract_class_use, tree, tsubst_flags_t);
> +extern int abstract_virtuals_error		(tree, tree,
> +						 tsubst_flags_t = tf_warning_or_error);
> +extern int abstract_virtuals_error		(abstract_class_use, tree,
> +						 tsubst_flags_t = tf_warning_or_error);
>   
>   extern tree store_init_value			(tree, tree, vec<tree, va_gc>**, int);
>   extern tree split_nonconstant_init		(tree, tree);
> @@ -8411,8 +8410,8 @@ extern bool require_potential_constant_expression (tree);
>   extern bool require_constant_expression (tree);
>   extern bool require_rvalue_constant_expression (tree);
>   extern bool require_potential_rvalue_constant_expression (tree);
> -extern tree cxx_constant_value			(tree, tree = NULL_TREE);
> -extern tree cxx_constant_value_sfinae		(tree, tree, tsubst_flags_t);
> +extern tree cxx_constant_value			(tree, tree = NULL_TREE,
> +						 tsubst_flags_t = tf_error);
>   extern void cxx_constant_dtor			(tree, tree);
>   extern tree cxx_constant_init			(tree, tree = NULL_TREE);
>   extern tree maybe_constant_value		(tree, tree = NULL_TREE, bool = false);
> diff --git a/gcc/cp/cvt.cc b/gcc/cp/cvt.cc
> index 30a98061350..434d306961f 100644
> --- a/gcc/cp/cvt.cc
> +++ b/gcc/cp/cvt.cc
> @@ -339,7 +339,7 @@ build_up_reference (tree type, tree arg, int flags, tree decl,
>   		      LOOKUP_ONLYCONVERTING|DIRECT_BIND);
>       }
>     else if (!(flags & DIRECT_BIND) && ! obvalue_p (arg))
> -    return get_target_expr_sfinae (arg, complain);
> +    return get_target_expr (arg, complain);
>   
>     /* If we had a way to wrap this up, and say, if we ever needed its
>        address, transform all occurrences of the register, into a memory
> @@ -939,7 +939,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags,
>   
>         ctor = e;
>   
> -      if (abstract_virtuals_error_sfinae (NULL_TREE, type, complain))
> +      if (abstract_virtuals_error (NULL_TREE, type, complain))
>   	return error_mark_node;
>   
>         if (BRACE_ENCLOSED_INITIALIZER_P (ctor))
> diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc
> index 4665a29a24d..492dbc283aa 100644
> --- a/gcc/cp/decl.cc
> +++ b/gcc/cp/decl.cc
> @@ -18553,7 +18553,7 @@ build_explicit_specifier (tree expr, tsubst_flags_t complain)
>       return expr;
>   
>     expr = build_converted_constant_bool_expr (expr, complain);
> -  expr = instantiate_non_dependent_expr_sfinae (expr, complain);
> +  expr = instantiate_non_dependent_expr (expr, complain);
>     expr = cxx_constant_value (expr);
>     return expr;
>   }
> diff --git a/gcc/cp/except.cc b/gcc/cp/except.cc
> index da0a65c613d..7fdbc747c22 100644
> --- a/gcc/cp/except.cc
> +++ b/gcc/cp/except.cc
> @@ -1256,7 +1256,7 @@ build_noexcept_spec (tree expr, tsubst_flags_t complain)
>         && !instantiation_dependent_expression_p (expr))
>       {
>         expr = build_converted_constant_bool_expr (expr, complain);
> -      expr = instantiate_non_dependent_expr_sfinae (expr, complain);
> +      expr = instantiate_non_dependent_expr (expr, complain);
>         expr = cxx_constant_value (expr);
>       }
>     if (TREE_CODE (expr) == INTEGER_CST)
> diff --git a/gcc/cp/init.cc b/gcc/cp/init.cc
> index edca8437f64..a85c3032130 100644
> --- a/gcc/cp/init.cc
> +++ b/gcc/cp/init.cc
> @@ -3158,7 +3158,7 @@ build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts,
>   	     "%<new%> of %<initializer_list%> does not "
>   	     "extend the lifetime of the underlying array");
>   
> -  if (abstract_virtuals_error_sfinae (ACU_NEW, elt_type, complain))
> +  if (abstract_virtuals_error (ACU_NEW, elt_type, complain))
>       return error_mark_node;
>   
>     is_initialized = (type_build_ctor_call (elt_type) || *init != NULL);
> diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
> index c5fc0f1eab8..9b97939eedd 100644
> --- a/gcc/cp/pt.cc
> +++ b/gcc/cp/pt.cc
> @@ -3868,7 +3868,7 @@ expand_integer_pack (tree call, tree args, tsubst_flags_t complain,
>       }
>     else
>       {
> -      hi = instantiate_non_dependent_expr_sfinae (hi, complain);
> +      hi = instantiate_non_dependent_expr (hi, complain);
>         hi = cxx_constant_value (hi);
>         int len = valid_constant_size_p (hi) ? tree_to_shwi (hi) : -1;
>   
> @@ -6428,7 +6428,7 @@ redeclare_class_template (tree type, tree parms, tree cons)
>       return true;
>   }
>   
> -/* The actual substitution part of instantiate_non_dependent_expr_sfinae,
> +/* The actual substitution part of instantiate_non_dependent_expr,
>      to be used when the caller has already checked
>       !instantiation_dependent_uneval_expression_p (expr)
>      and cleared processing_template_decl.  */
> @@ -6447,7 +6447,8 @@ instantiate_non_dependent_expr_internal (tree expr, tsubst_flags_t complain)
>   /* Instantiate the non-dependent expression EXPR.  */
>   
>   tree
> -instantiate_non_dependent_expr_sfinae (tree expr, tsubst_flags_t complain)
> +instantiate_non_dependent_expr (tree expr,
> +				tsubst_flags_t complain /* = tf_error */)
>   {
>     if (expr == NULL_TREE)
>       return NULL_TREE;
> @@ -6462,12 +6463,6 @@ instantiate_non_dependent_expr_sfinae (tree expr, tsubst_flags_t complain)
>     return expr;
>   }
>   
> -tree
> -instantiate_non_dependent_expr (tree expr)
> -{
> -  return instantiate_non_dependent_expr_sfinae (expr, tf_error);
> -}
> -
>   /* Like instantiate_non_dependent_expr, but return NULL_TREE if the
>      expression is dependent or non-constant.  */
>   
> @@ -16970,7 +16965,7 @@ tsubst_init (tree init, tree decl, tree args,
>   	     zero.  */
>   	  init = build_value_init (type, complain);
>   	  if (TREE_CODE (init) == AGGR_INIT_EXPR)
> -	    init = get_target_expr_sfinae (init, complain);
> +	    init = get_target_expr (init, complain);
>   	  if (TREE_CODE (init) == TARGET_EXPR)
>   	    TARGET_EXPR_DIRECT_INIT_P (init) = true;
>   	}
> @@ -20124,7 +20119,7 @@ fold_targs_r (tree targs, tsubst_flags_t complain)
>   	       && !glvalue_p (elt)
>   	       && !TREE_CONSTANT (elt))
>   	{
> -	  elt = cxx_constant_value_sfinae (elt, NULL_TREE, complain);
> +	  elt = cxx_constant_value (elt, NULL_TREE, complain);
>   	  if (elt == error_mark_node)
>   	    return false;
>   	}
> diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
> index 6bda30e1b7a..3edefb2fca2 100644
> --- a/gcc/cp/semantics.cc
> +++ b/gcc/cp/semantics.cc
> @@ -3318,7 +3318,7 @@ finish_compound_literal (tree type, tree compound_literal,
>         /* The CONSTRUCTOR is now an initializer, not a compound literal.  */
>         if (TREE_CODE (compound_literal) == CONSTRUCTOR)
>   	TREE_HAS_CONSTRUCTOR (compound_literal) = false;
> -      compound_literal = get_target_expr_sfinae (compound_literal, complain);
> +      compound_literal = get_target_expr (compound_literal, complain);
>       }
>     else
>       /* For e.g. int{42} just make sure it's a prvalue.  */
> @@ -11329,7 +11329,7 @@ finish_decltype_type (tree expr, bool id_expression_or_member_access_p,
>       }
>     else if (processing_template_decl)
>       {
> -      expr = instantiate_non_dependent_expr_sfinae (expr, complain|tf_decltype);
> +      expr = instantiate_non_dependent_expr (expr, complain|tf_decltype);
>         if (expr == error_mark_node)
>   	return error_mark_node;
>         /* Keep processing_template_decl cleared for the rest of the function
> @@ -12500,7 +12500,7 @@ cp_build_bit_cast (location_t loc, tree type, tree arg,
>     SET_EXPR_LOCATION (ret, loc);
>   
>     if (!processing_template_decl && CLASS_TYPE_P (type))
> -    ret = get_target_expr_sfinae (ret, complain);
> +    ret = get_target_expr (ret, complain);
>   
>     return ret;
>   }
> diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc
> index c678e3b9c4c..fb10911b3b4 100644
> --- a/gcc/cp/tree.cc
> +++ b/gcc/cp/tree.cc
> @@ -713,7 +713,7 @@ build_cplus_new (tree type, tree init, tsubst_flags_t complain)
>   
>     /* Make sure that we're not trying to create an instance of an
>        abstract class.  */
> -  if (abstract_virtuals_error_sfinae (NULL_TREE, type, complain))
> +  if (abstract_virtuals_error (NULL_TREE, type, complain))
>       return error_mark_node;
>   
>     if (TREE_CODE (rval) == AGGR_INIT_EXPR)
> @@ -922,7 +922,7 @@ force_target_expr (tree type, tree init, tsubst_flags_t complain)
>   /* Like build_target_expr_with_type, but use the type of INIT.  */
>   
>   tree
> -get_target_expr_sfinae (tree init, tsubst_flags_t complain)
> +get_target_expr (tree init, tsubst_flags_t complain /* = tf_warning_or_error */)
>   {
>     if (TREE_CODE (init) == AGGR_INIT_EXPR)
>       return build_target_expr (AGGR_INIT_EXPR_SLOT (init), init, complain);
> @@ -935,12 +935,6 @@ get_target_expr_sfinae (tree init, tsubst_flags_t complain)
>       }
>   }
>   
> -tree
> -get_target_expr (tree init)
> -{
> -  return get_target_expr_sfinae (init, tf_warning_or_error);
> -}
> -
>   /* If EXPR is a bitfield reference, convert it to the declared type of
>      the bitfield, and return the resulting expression.  Otherwise,
>      return EXPR itself.  */
> diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc
> index b99947c10fd..3e461d5cdcb 100644
> --- a/gcc/cp/typeck.cc
> +++ b/gcc/cp/typeck.cc
> @@ -71,7 +71,8 @@ static bool is_std_forward_p (tree);
>      complete type when this function returns.  */
>   
>   tree
> -require_complete_type_sfinae (tree value, tsubst_flags_t complain)
> +require_complete_type (tree value,
> +		       tsubst_flags_t complain /* = tf_warning_or_error */)
>   {
>     tree type;
>   
> @@ -96,12 +97,6 @@ require_complete_type_sfinae (tree value, tsubst_flags_t complain)
>       return error_mark_node;
>   }
>   
> -tree
> -require_complete_type (tree value)
> -{
> -  return require_complete_type_sfinae (value, tf_warning_or_error);
> -}
> -
>   /* Try to complete TYPE, if it is incomplete.  For example, if TYPE is
>      a template instantiation, do the instantiation.  Returns TYPE,
>      whether or not it could be completed, unless something goes
> @@ -3899,7 +3894,7 @@ cp_build_array_ref (location_t loc, tree array, tree idx,
>   	|= (CP_TYPE_VOLATILE_P (type) | TREE_SIDE_EFFECTS (array));
>         TREE_THIS_VOLATILE (rval)
>   	|= (CP_TYPE_VOLATILE_P (type) | TREE_THIS_VOLATILE (array));
> -      ret = require_complete_type_sfinae (rval, complain);
> +      ret = require_complete_type (rval, complain);
>         protected_set_expr_location (ret, loc);
>         if (non_lvalue)
>   	ret = non_lvalue_loc (loc, ret);
> @@ -4464,7 +4459,7 @@ convert_arguments (tree typelist, vec<tree, va_gc> **values, tree fndecl,
>   	    /* Don't do ellipsis conversion for __built_in_constant_p
>   	       as this will result in spurious errors for non-trivial
>   	       types.  */
> -	    val = require_complete_type_sfinae (val, complain);
> +	    val = require_complete_type (val, complain);
>   	  else
>   	    val = convert_arg_to_ellipsis (val, complain);
>   
> @@ -6264,7 +6259,7 @@ cp_build_binary_op (const op_location_t &location,
>   		     instrument_expr, result);
>   
>     if (resultcode == SPACESHIP_EXPR && !processing_template_decl)
> -    result = get_target_expr_sfinae (result, complain);
> +    result = get_target_expr (result, complain);
>   
>     if (!c_inhibit_evaluation_warnings)
>       {
> @@ -8016,7 +8011,7 @@ build_static_cast_1 (location_t loc, tree type, tree expr, bool c_cast_p,
>     /* [class.abstract]
>        An abstract class shall not be used ... as the type of an explicit
>        conversion.  */
> -  if (abstract_virtuals_error_sfinae (ACU_CAST, type, complain))
> +  if (abstract_virtuals_error (ACU_CAST, type, complain))
>       return error_mark_node;
>   
>     /* [expr.static.cast]
> @@ -9144,7 +9139,7 @@ cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode,
>       }
>     else
>       {
> -      lhs = require_complete_type_sfinae (lhs, complain);
> +      lhs = require_complete_type (lhs, complain);
>         if (lhs == error_mark_node)
>   	return error_mark_node;
>   
> @@ -10123,7 +10118,7 @@ convert_for_initialization (tree exp, tree type, tree rhs, int flags,
>       }
>   
>     if (exp != 0)
> -    exp = require_complete_type_sfinae (exp, complain);
> +    exp = require_complete_type (exp, complain);
>     if (exp == error_mark_node)
>       return error_mark_node;
>   
> diff --git a/gcc/cp/typeck2.cc b/gcc/cp/typeck2.cc
> index 1a96be3d412..688e9c15326 100644
> --- a/gcc/cp/typeck2.cc
> +++ b/gcc/cp/typeck2.cc
> @@ -130,8 +130,8 @@ cxx_readonly_error (location_t loc, tree arg, enum lvalue_use errstring)
>      all was well.  */
>   
>   static int
> -abstract_virtuals_error_sfinae (tree decl, tree type, abstract_class_use use,
> -				tsubst_flags_t complain)
> +abstract_virtuals_error (tree decl, tree type, abstract_class_use use,
> +			 tsubst_flags_t complain)
>   {
>     vec<tree, va_gc> *pure;
>   
> @@ -251,32 +251,19 @@ abstract_virtuals_error_sfinae (tree decl, tree type, abstract_class_use use,
>   }
>   
>   int
> -abstract_virtuals_error_sfinae (tree decl, tree type, tsubst_flags_t complain)
> -{
> -  return abstract_virtuals_error_sfinae (decl, type, ACU_UNKNOWN, complain);
> -}
> -
> -int
> -abstract_virtuals_error_sfinae (abstract_class_use use, tree type,
> -				tsubst_flags_t complain)
> +abstract_virtuals_error (tree decl, tree type,
> +			 tsubst_flags_t complain /* = tf_warning_or_error */)
>   {
> -  return abstract_virtuals_error_sfinae (NULL_TREE, type, use, complain);
> +  return abstract_virtuals_error (decl, type, ACU_UNKNOWN, complain);
>   }
>   
> -
> -/* Wrapper for the above function in the common case of wanting errors.  */
> -
>   int
> -abstract_virtuals_error (tree decl, tree type)
> +abstract_virtuals_error (abstract_class_use use, tree type,
> +			 tsubst_flags_t complain /* = tf_warning_or_error */)
>   {
> -  return abstract_virtuals_error_sfinae (decl, type, tf_warning_or_error);
> +  return abstract_virtuals_error (NULL_TREE, type, use, complain);
>   }
>   
> -int
> -abstract_virtuals_error (abstract_class_use use, tree type)
> -{
> -  return abstract_virtuals_error_sfinae (use, type, tf_warning_or_error);
> -}
>   
>   /* Print an inform about the declaration of the incomplete type TYPE.  */
>   
> @@ -2502,7 +2489,7 @@ build_functional_cast_1 (location_t loc, tree exp, tree parms,
>   
>     if (!complete_type_or_maybe_complain (type, NULL_TREE, complain))
>       return error_mark_node;
> -  if (abstract_virtuals_error_sfinae (ACU_CAST, type, complain))
> +  if (abstract_virtuals_error (ACU_CAST, type, complain))
>       return error_mark_node;
>   
>     /* [expr.type.conv]
> @@ -2523,7 +2510,7 @@ build_functional_cast_1 (location_t loc, tree exp, tree parms,
>     if (parms == NULL_TREE)
>       {
>         exp = build_value_init (type, complain);
> -      exp = get_target_expr_sfinae (exp, complain);
> +      exp = get_target_expr (exp, complain);
>         return exp;
>       }
>
  

Patch

diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc
index d107a2814dc..7e9289fc2d0 100644
--- a/gcc/cp/call.cc
+++ b/gcc/cp/call.cc
@@ -5976,7 +5976,7 @@  build_conditional_expr (const op_location_t &loc,
 	 but now we sometimes wrap them in NOP_EXPRs so the test would
 	 fail.  */
       if (CLASS_TYPE_P (TREE_TYPE (result)))
-	result = get_target_expr_sfinae (result, complain);
+	result = get_target_expr (result, complain);
       /* If this expression is an rvalue, but might be mistaken for an
 	 lvalue, we must add a NON_LVALUE_EXPR.  */
       result = rvalue (result);
@@ -7672,7 +7672,7 @@  build_temp (tree expr, tree type, int flags,
   if ((lvalue_kind (expr) & clk_packed)
       && CLASS_TYPE_P (TREE_TYPE (expr))
       && !type_has_nontrivial_copy_init (TREE_TYPE (expr)))
-    return get_target_expr_sfinae (expr, complain);
+    return get_target_expr (expr, complain);
 
   /* In decltype, we might have decided not to wrap this call in a TARGET_EXPR.
      But it turns out to be a subexpression, so perform temporary
@@ -8008,10 +8008,10 @@  convert_like_internal (conversion *convs, tree expr, tree fn, int argnum,
 	    && !processing_template_decl)
 	  {
 	    bool direct = CONSTRUCTOR_IS_DIRECT_INIT (expr);
-	    if (abstract_virtuals_error_sfinae (NULL_TREE, totype, complain))
+	    if (abstract_virtuals_error (NULL_TREE, totype, complain))
 	      return error_mark_node;
 	    expr = build_value_init (totype, complain);
-	    expr = get_target_expr_sfinae (expr, complain);
+	    expr = get_target_expr (expr, complain);
 	    if (expr != error_mark_node)
 	      {
 		TARGET_EXPR_LIST_INIT_P (expr) = true;
@@ -8137,7 +8137,7 @@  convert_like_internal (conversion *convs, tree expr, tree fn, int argnum,
 	field = next_aggregate_field (DECL_CHAIN (field));
 	CONSTRUCTOR_APPEND_ELT (vec, field, size_int (len));
 	tree new_ctor = build_constructor (totype, vec);
-	return get_target_expr_sfinae (new_ctor, complain);
+	return get_target_expr (new_ctor, complain);
       }
 
     case ck_aggr:
@@ -8153,7 +8153,7 @@  convert_like_internal (conversion *convs, tree expr, tree fn, int argnum,
 	  return expr;
 	}
       expr = reshape_init (totype, expr, complain);
-      expr = get_target_expr_sfinae (digest_init (totype, expr, complain),
+      expr = get_target_expr (digest_init (totype, expr, complain),
 				     complain);
       if (expr != error_mark_node)
 	TARGET_EXPR_LIST_INIT_P (expr) = true;
@@ -8580,12 +8580,12 @@  convert_arg_to_ellipsis (tree arg, tsubst_flags_t complain)
        standard conversions are performed.  */
     arg = decay_conversion (arg, complain);
 
-  arg = require_complete_type_sfinae (arg, complain);
+  arg = require_complete_type (arg, complain);
   arg_type = TREE_TYPE (arg);
 
   if (arg != error_mark_node
       /* In a template (or ill-formed code), we can have an incomplete type
-	 even after require_complete_type_sfinae, in which case we don't know
+	 even after require_complete_type, in which case we don't know
 	 whether it has trivial copy or not.  */
       && COMPLETE_TYPE_P (arg_type)
       && !cp_unevaluated_operand)
@@ -10000,7 +10000,7 @@  build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
 		    obj_arg = TREE_OPERAND (addr, 0);
 		}
 	    }
-	  call = cxx_constant_value_sfinae (call, obj_arg, complain);
+	  call = cxx_constant_value (call, obj_arg, complain);
 	  if (obj_arg && !error_operand_p (call))
 	    call = build2 (INIT_EXPR, void_type_node, obj_arg, call);
 	  call = convert_from_reference (call);
@@ -10505,7 +10505,7 @@  build_cxx_call (tree fn, int nargs, tree *argarray,
      prvalue. The type of the prvalue may be incomplete.  */
   if (!(complain & tf_decltype))
     {
-      fn = require_complete_type_sfinae (fn, complain);
+      fn = require_complete_type (fn, complain);
       if (fn == error_mark_node)
 	return error_mark_node;
 
@@ -11084,7 +11084,7 @@  build_new_method_call (tree instance, tree fns, vec<tree, va_gc> **args,
       if (init)
 	{
 	  if (is_dummy_object (instance))
-	    return get_target_expr_sfinae (init, complain);
+	    return get_target_expr (init, complain);
 	  init = build2 (INIT_EXPR, TREE_TYPE (instance), instance, init);
 	  TREE_SIDE_EFFECTS (init) = true;
 	  return init;
diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
index c047fe4a2a1..57283eabf3c 100644
--- a/gcc/cp/constexpr.cc
+++ b/gcc/cp/constexpr.cc
@@ -8068,7 +8068,7 @@  cxx_eval_outermost_constant_expr (tree t, bool allow_non_constant,
 	r = get_target_expr (r);
       else
 	{
-	  r = get_target_expr_sfinae (r, tf_warning_or_error | tf_no_cleanup);
+	  r = get_target_expr (r, tf_warning_or_error | tf_no_cleanup);
 	  TREE_CONSTANT (r) = true;
 	}
     }
@@ -8081,19 +8081,11 @@  cxx_eval_outermost_constant_expr (tree t, bool allow_non_constant,
 }
 
 /* If T represents a constant expression returns its reduced value.
-   Otherwise return error_mark_node.  If T is dependent, then
-   return NULL.  */
+   Otherwise return error_mark_node.  */
 
 tree
-cxx_constant_value (tree t, tree decl)
-{
-  return cxx_eval_outermost_constant_expr (t, false, true, true, false, decl);
-}
-
-/* As above, but respect SFINAE.  */
-
-tree
-cxx_constant_value_sfinae (tree t, tree decl, tsubst_flags_t complain)
+cxx_constant_value (tree t, tree decl /* = NULL_TREE */,
+		    tsubst_flags_t complain /* = tf_error */)
 {
   bool sfinae = !(complain & tf_error);
   tree r = cxx_eval_outermost_constant_expr (t, sfinae, true, true, false, decl);
@@ -8316,8 +8308,8 @@  fold_non_dependent_expr_template (tree t, tsubst_flags_t complain,
 
 /* Like maybe_constant_value but first fully instantiate the argument.
 
-   Note: this is equivalent to instantiate_non_dependent_expr_sfinae
-   (t, complain) followed by maybe_constant_value but is more efficient,
+   Note: this is equivalent to instantiate_non_dependent_expr (t, complain)
+   followed by maybe_constant_value but is more efficient,
    because it calls instantiation_dependent_expression_p and
    potential_constant_expression at most once.
    The manifestly_const_eval argument is passed to maybe_constant_value.
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 6648e5b5fde..aa16c0fe6a2 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -7390,8 +7390,7 @@  extern tree template_for_substitution		(tree);
 extern tree build_non_dependent_expr		(tree);
 extern void make_args_non_dependent		(vec<tree, va_gc> *);
 extern bool reregister_specialization		(tree, tree, tree);
-extern tree instantiate_non_dependent_expr	(tree);
-extern tree instantiate_non_dependent_expr_sfinae (tree, tsubst_flags_t);
+extern tree instantiate_non_dependent_expr	(tree, tsubst_flags_t = tf_error);
 extern tree instantiate_non_dependent_expr_internal (tree, tsubst_flags_t);
 extern tree instantiate_non_dependent_or_null   (tree);
 extern bool variable_template_specialization_p  (tree);
@@ -7823,8 +7822,8 @@  extern tree build_cplus_new			(tree, tree, tsubst_flags_t);
 extern tree build_local_temp			(tree);
 extern bool is_local_temp			(tree);
 extern tree build_aggr_init_expr		(tree, tree);
-extern tree get_target_expr			(tree);
-extern tree get_target_expr_sfinae		(tree, tsubst_flags_t);
+extern tree get_target_expr			(tree,
+						 tsubst_flags_t = tf_warning_or_error);
 extern tree build_cplus_array_type		(tree, tree, int is_dep = -1);
 extern tree build_array_of_n_type		(tree, int);
 extern bool array_of_runtime_bound_p		(tree);
@@ -7936,8 +7935,8 @@  extern int string_conv_p			(const_tree, const_tree, int);
 extern tree cp_truthvalue_conversion		(tree, tsubst_flags_t);
 extern tree contextual_conv_bool		(tree, tsubst_flags_t);
 extern tree condition_conversion		(tree);
-extern tree require_complete_type		(tree);
-extern tree require_complete_type_sfinae	(tree, tsubst_flags_t);
+extern tree require_complete_type		(tree,
+						 tsubst_flags_t = tf_warning_or_error);
 extern tree complete_type			(tree);
 extern tree complete_type_or_else		(tree, tree);
 extern tree complete_type_or_maybe_complain	(tree, tree, tsubst_flags_t);
@@ -8151,10 +8150,10 @@  extern tree binfo_or_else			(tree, tree);
 extern void cxx_readonly_error			(location_t, tree,
 						 enum lvalue_use);
 extern void complete_type_check_abstract	(tree);
-extern int abstract_virtuals_error		(tree, tree);
-extern int abstract_virtuals_error		(abstract_class_use, tree);
-extern int abstract_virtuals_error_sfinae	(tree, tree, tsubst_flags_t);
-extern int abstract_virtuals_error_sfinae	(abstract_class_use, tree, tsubst_flags_t);
+extern int abstract_virtuals_error		(tree, tree,
+						 tsubst_flags_t = tf_warning_or_error);
+extern int abstract_virtuals_error		(abstract_class_use, tree,
+						 tsubst_flags_t = tf_warning_or_error);
 
 extern tree store_init_value			(tree, tree, vec<tree, va_gc>**, int);
 extern tree split_nonconstant_init		(tree, tree);
@@ -8411,8 +8410,8 @@  extern bool require_potential_constant_expression (tree);
 extern bool require_constant_expression (tree);
 extern bool require_rvalue_constant_expression (tree);
 extern bool require_potential_rvalue_constant_expression (tree);
-extern tree cxx_constant_value			(tree, tree = NULL_TREE);
-extern tree cxx_constant_value_sfinae		(tree, tree, tsubst_flags_t);
+extern tree cxx_constant_value			(tree, tree = NULL_TREE,
+						 tsubst_flags_t = tf_error);
 extern void cxx_constant_dtor			(tree, tree);
 extern tree cxx_constant_init			(tree, tree = NULL_TREE);
 extern tree maybe_constant_value		(tree, tree = NULL_TREE, bool = false);
diff --git a/gcc/cp/cvt.cc b/gcc/cp/cvt.cc
index 30a98061350..434d306961f 100644
--- a/gcc/cp/cvt.cc
+++ b/gcc/cp/cvt.cc
@@ -339,7 +339,7 @@  build_up_reference (tree type, tree arg, int flags, tree decl,
 		      LOOKUP_ONLYCONVERTING|DIRECT_BIND);
     }
   else if (!(flags & DIRECT_BIND) && ! obvalue_p (arg))
-    return get_target_expr_sfinae (arg, complain);
+    return get_target_expr (arg, complain);
 
   /* If we had a way to wrap this up, and say, if we ever needed its
      address, transform all occurrences of the register, into a memory
@@ -939,7 +939,7 @@  ocp_convert (tree type, tree expr, int convtype, int flags,
 
       ctor = e;
 
-      if (abstract_virtuals_error_sfinae (NULL_TREE, type, complain))
+      if (abstract_virtuals_error (NULL_TREE, type, complain))
 	return error_mark_node;
 
       if (BRACE_ENCLOSED_INITIALIZER_P (ctor))
diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc
index 4665a29a24d..492dbc283aa 100644
--- a/gcc/cp/decl.cc
+++ b/gcc/cp/decl.cc
@@ -18553,7 +18553,7 @@  build_explicit_specifier (tree expr, tsubst_flags_t complain)
     return expr;
 
   expr = build_converted_constant_bool_expr (expr, complain);
-  expr = instantiate_non_dependent_expr_sfinae (expr, complain);
+  expr = instantiate_non_dependent_expr (expr, complain);
   expr = cxx_constant_value (expr);
   return expr;
 }
diff --git a/gcc/cp/except.cc b/gcc/cp/except.cc
index da0a65c613d..7fdbc747c22 100644
--- a/gcc/cp/except.cc
+++ b/gcc/cp/except.cc
@@ -1256,7 +1256,7 @@  build_noexcept_spec (tree expr, tsubst_flags_t complain)
       && !instantiation_dependent_expression_p (expr))
     {
       expr = build_converted_constant_bool_expr (expr, complain);
-      expr = instantiate_non_dependent_expr_sfinae (expr, complain);
+      expr = instantiate_non_dependent_expr (expr, complain);
       expr = cxx_constant_value (expr);
     }
   if (TREE_CODE (expr) == INTEGER_CST)
diff --git a/gcc/cp/init.cc b/gcc/cp/init.cc
index edca8437f64..a85c3032130 100644
--- a/gcc/cp/init.cc
+++ b/gcc/cp/init.cc
@@ -3158,7 +3158,7 @@  build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts,
 	     "%<new%> of %<initializer_list%> does not "
 	     "extend the lifetime of the underlying array");
 
-  if (abstract_virtuals_error_sfinae (ACU_NEW, elt_type, complain))
+  if (abstract_virtuals_error (ACU_NEW, elt_type, complain))
     return error_mark_node;
 
   is_initialized = (type_build_ctor_call (elt_type) || *init != NULL);
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index c5fc0f1eab8..9b97939eedd 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -3868,7 +3868,7 @@  expand_integer_pack (tree call, tree args, tsubst_flags_t complain,
     }
   else
     {
-      hi = instantiate_non_dependent_expr_sfinae (hi, complain);
+      hi = instantiate_non_dependent_expr (hi, complain);
       hi = cxx_constant_value (hi);
       int len = valid_constant_size_p (hi) ? tree_to_shwi (hi) : -1;
 
@@ -6428,7 +6428,7 @@  redeclare_class_template (tree type, tree parms, tree cons)
     return true;
 }
 
-/* The actual substitution part of instantiate_non_dependent_expr_sfinae,
+/* The actual substitution part of instantiate_non_dependent_expr,
    to be used when the caller has already checked
     !instantiation_dependent_uneval_expression_p (expr)
    and cleared processing_template_decl.  */
@@ -6447,7 +6447,8 @@  instantiate_non_dependent_expr_internal (tree expr, tsubst_flags_t complain)
 /* Instantiate the non-dependent expression EXPR.  */
 
 tree
-instantiate_non_dependent_expr_sfinae (tree expr, tsubst_flags_t complain)
+instantiate_non_dependent_expr (tree expr,
+				tsubst_flags_t complain /* = tf_error */)
 {
   if (expr == NULL_TREE)
     return NULL_TREE;
@@ -6462,12 +6463,6 @@  instantiate_non_dependent_expr_sfinae (tree expr, tsubst_flags_t complain)
   return expr;
 }
 
-tree
-instantiate_non_dependent_expr (tree expr)
-{
-  return instantiate_non_dependent_expr_sfinae (expr, tf_error);
-}
-
 /* Like instantiate_non_dependent_expr, but return NULL_TREE if the
    expression is dependent or non-constant.  */
 
@@ -16970,7 +16965,7 @@  tsubst_init (tree init, tree decl, tree args,
 	     zero.  */
 	  init = build_value_init (type, complain);
 	  if (TREE_CODE (init) == AGGR_INIT_EXPR)
-	    init = get_target_expr_sfinae (init, complain);
+	    init = get_target_expr (init, complain);
 	  if (TREE_CODE (init) == TARGET_EXPR)
 	    TARGET_EXPR_DIRECT_INIT_P (init) = true;
 	}
@@ -20124,7 +20119,7 @@  fold_targs_r (tree targs, tsubst_flags_t complain)
 	       && !glvalue_p (elt)
 	       && !TREE_CONSTANT (elt))
 	{
-	  elt = cxx_constant_value_sfinae (elt, NULL_TREE, complain);
+	  elt = cxx_constant_value (elt, NULL_TREE, complain);
 	  if (elt == error_mark_node)
 	    return false;
 	}
diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
index 6bda30e1b7a..3edefb2fca2 100644
--- a/gcc/cp/semantics.cc
+++ b/gcc/cp/semantics.cc
@@ -3318,7 +3318,7 @@  finish_compound_literal (tree type, tree compound_literal,
       /* The CONSTRUCTOR is now an initializer, not a compound literal.  */
       if (TREE_CODE (compound_literal) == CONSTRUCTOR)
 	TREE_HAS_CONSTRUCTOR (compound_literal) = false;
-      compound_literal = get_target_expr_sfinae (compound_literal, complain);
+      compound_literal = get_target_expr (compound_literal, complain);
     }
   else
     /* For e.g. int{42} just make sure it's a prvalue.  */
@@ -11329,7 +11329,7 @@  finish_decltype_type (tree expr, bool id_expression_or_member_access_p,
     }
   else if (processing_template_decl)
     {
-      expr = instantiate_non_dependent_expr_sfinae (expr, complain|tf_decltype);
+      expr = instantiate_non_dependent_expr (expr, complain|tf_decltype);
       if (expr == error_mark_node)
 	return error_mark_node;
       /* Keep processing_template_decl cleared for the rest of the function
@@ -12500,7 +12500,7 @@  cp_build_bit_cast (location_t loc, tree type, tree arg,
   SET_EXPR_LOCATION (ret, loc);
 
   if (!processing_template_decl && CLASS_TYPE_P (type))
-    ret = get_target_expr_sfinae (ret, complain);
+    ret = get_target_expr (ret, complain);
 
   return ret;
 }
diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc
index c678e3b9c4c..fb10911b3b4 100644
--- a/gcc/cp/tree.cc
+++ b/gcc/cp/tree.cc
@@ -713,7 +713,7 @@  build_cplus_new (tree type, tree init, tsubst_flags_t complain)
 
   /* Make sure that we're not trying to create an instance of an
      abstract class.  */
-  if (abstract_virtuals_error_sfinae (NULL_TREE, type, complain))
+  if (abstract_virtuals_error (NULL_TREE, type, complain))
     return error_mark_node;
 
   if (TREE_CODE (rval) == AGGR_INIT_EXPR)
@@ -922,7 +922,7 @@  force_target_expr (tree type, tree init, tsubst_flags_t complain)
 /* Like build_target_expr_with_type, but use the type of INIT.  */
 
 tree
-get_target_expr_sfinae (tree init, tsubst_flags_t complain)
+get_target_expr (tree init, tsubst_flags_t complain /* = tf_warning_or_error */)
 {
   if (TREE_CODE (init) == AGGR_INIT_EXPR)
     return build_target_expr (AGGR_INIT_EXPR_SLOT (init), init, complain);
@@ -935,12 +935,6 @@  get_target_expr_sfinae (tree init, tsubst_flags_t complain)
     }
 }
 
-tree
-get_target_expr (tree init)
-{
-  return get_target_expr_sfinae (init, tf_warning_or_error);
-}
-
 /* If EXPR is a bitfield reference, convert it to the declared type of
    the bitfield, and return the resulting expression.  Otherwise,
    return EXPR itself.  */
diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc
index b99947c10fd..3e461d5cdcb 100644
--- a/gcc/cp/typeck.cc
+++ b/gcc/cp/typeck.cc
@@ -71,7 +71,8 @@  static bool is_std_forward_p (tree);
    complete type when this function returns.  */
 
 tree
-require_complete_type_sfinae (tree value, tsubst_flags_t complain)
+require_complete_type (tree value,
+		       tsubst_flags_t complain /* = tf_warning_or_error */)
 {
   tree type;
 
@@ -96,12 +97,6 @@  require_complete_type_sfinae (tree value, tsubst_flags_t complain)
     return error_mark_node;
 }
 
-tree
-require_complete_type (tree value)
-{
-  return require_complete_type_sfinae (value, tf_warning_or_error);
-}
-
 /* Try to complete TYPE, if it is incomplete.  For example, if TYPE is
    a template instantiation, do the instantiation.  Returns TYPE,
    whether or not it could be completed, unless something goes
@@ -3899,7 +3894,7 @@  cp_build_array_ref (location_t loc, tree array, tree idx,
 	|= (CP_TYPE_VOLATILE_P (type) | TREE_SIDE_EFFECTS (array));
       TREE_THIS_VOLATILE (rval)
 	|= (CP_TYPE_VOLATILE_P (type) | TREE_THIS_VOLATILE (array));
-      ret = require_complete_type_sfinae (rval, complain);
+      ret = require_complete_type (rval, complain);
       protected_set_expr_location (ret, loc);
       if (non_lvalue)
 	ret = non_lvalue_loc (loc, ret);
@@ -4464,7 +4459,7 @@  convert_arguments (tree typelist, vec<tree, va_gc> **values, tree fndecl,
 	    /* Don't do ellipsis conversion for __built_in_constant_p
 	       as this will result in spurious errors for non-trivial
 	       types.  */
-	    val = require_complete_type_sfinae (val, complain);
+	    val = require_complete_type (val, complain);
 	  else
 	    val = convert_arg_to_ellipsis (val, complain);
 
@@ -6264,7 +6259,7 @@  cp_build_binary_op (const op_location_t &location,
 		     instrument_expr, result);
 
   if (resultcode == SPACESHIP_EXPR && !processing_template_decl)
-    result = get_target_expr_sfinae (result, complain);
+    result = get_target_expr (result, complain);
 
   if (!c_inhibit_evaluation_warnings)
     {
@@ -8016,7 +8011,7 @@  build_static_cast_1 (location_t loc, tree type, tree expr, bool c_cast_p,
   /* [class.abstract]
      An abstract class shall not be used ... as the type of an explicit
      conversion.  */
-  if (abstract_virtuals_error_sfinae (ACU_CAST, type, complain))
+  if (abstract_virtuals_error (ACU_CAST, type, complain))
     return error_mark_node;
 
   /* [expr.static.cast]
@@ -9144,7 +9139,7 @@  cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode,
     }
   else
     {
-      lhs = require_complete_type_sfinae (lhs, complain);
+      lhs = require_complete_type (lhs, complain);
       if (lhs == error_mark_node)
 	return error_mark_node;
 
@@ -10123,7 +10118,7 @@  convert_for_initialization (tree exp, tree type, tree rhs, int flags,
     }
 
   if (exp != 0)
-    exp = require_complete_type_sfinae (exp, complain);
+    exp = require_complete_type (exp, complain);
   if (exp == error_mark_node)
     return error_mark_node;
 
diff --git a/gcc/cp/typeck2.cc b/gcc/cp/typeck2.cc
index 1a96be3d412..688e9c15326 100644
--- a/gcc/cp/typeck2.cc
+++ b/gcc/cp/typeck2.cc
@@ -130,8 +130,8 @@  cxx_readonly_error (location_t loc, tree arg, enum lvalue_use errstring)
    all was well.  */
 
 static int
-abstract_virtuals_error_sfinae (tree decl, tree type, abstract_class_use use,
-				tsubst_flags_t complain)
+abstract_virtuals_error (tree decl, tree type, abstract_class_use use,
+			 tsubst_flags_t complain)
 {
   vec<tree, va_gc> *pure;
 
@@ -251,32 +251,19 @@  abstract_virtuals_error_sfinae (tree decl, tree type, abstract_class_use use,
 }
 
 int
-abstract_virtuals_error_sfinae (tree decl, tree type, tsubst_flags_t complain)
-{
-  return abstract_virtuals_error_sfinae (decl, type, ACU_UNKNOWN, complain);
-}
-
-int
-abstract_virtuals_error_sfinae (abstract_class_use use, tree type,
-				tsubst_flags_t complain)
+abstract_virtuals_error (tree decl, tree type,
+			 tsubst_flags_t complain /* = tf_warning_or_error */)
 {
-  return abstract_virtuals_error_sfinae (NULL_TREE, type, use, complain);
+  return abstract_virtuals_error (decl, type, ACU_UNKNOWN, complain);
 }
 
-
-/* Wrapper for the above function in the common case of wanting errors.  */
-
 int
-abstract_virtuals_error (tree decl, tree type)
+abstract_virtuals_error (abstract_class_use use, tree type,
+			 tsubst_flags_t complain /* = tf_warning_or_error */)
 {
-  return abstract_virtuals_error_sfinae (decl, type, tf_warning_or_error);
+  return abstract_virtuals_error (NULL_TREE, type, use, complain);
 }
 
-int
-abstract_virtuals_error (abstract_class_use use, tree type)
-{
-  return abstract_virtuals_error_sfinae (use, type, tf_warning_or_error);
-}
 
 /* Print an inform about the declaration of the incomplete type TYPE.  */
 
@@ -2502,7 +2489,7 @@  build_functional_cast_1 (location_t loc, tree exp, tree parms,
 
   if (!complete_type_or_maybe_complain (type, NULL_TREE, complain))
     return error_mark_node;
-  if (abstract_virtuals_error_sfinae (ACU_CAST, type, complain))
+  if (abstract_virtuals_error (ACU_CAST, type, complain))
     return error_mark_node;
 
   /* [expr.type.conv]
@@ -2523,7 +2510,7 @@  build_functional_cast_1 (location_t loc, tree exp, tree parms,
   if (parms == NULL_TREE)
     {
       exp = build_value_init (type, complain);
-      exp = get_target_expr_sfinae (exp, complain);
+      exp = get_target_expr (exp, complain);
       return exp;
     }