From: Paolo Carlini Date: Sun, 7 Oct 2012 23:08:49 +0000 (+0000) Subject: pt.c (fold_non_dependent_expr_sfinae): Remove static specifier. X-Git-Tag: misc/gccgo-go1_1_2~345 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=81bd268ceb57db1d3996b63b66054b4dce8dbb06;p=thirdparty%2Fgcc.git pt.c (fold_non_dependent_expr_sfinae): Remove static specifier. 2012-10-07 Paolo Carlini * pt.c (fold_non_dependent_expr_sfinae): Remove static specifier. (tsubst_copy_and_build): Use get_target_expr_sfinae. * call.c (build_conditional_expr_1, convert_like_real): Likewise. * cvt.c (build_up_reference): Likewise. (ocp_convert): Use abstract_virtuals_error_sfinae. (build_up_reference): Propagate complain to cp_build_addr_expr. * decl.c (compute_array_index_type): Use fold_non_dependent_expr_sfinae. * cp-tree.h: Update declarations. * cvt.c (build_expr_type_conversion): Tidy. * tree.c (stabilize_aggr_init): Change to static. From-SVN: r192188 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0113fa4a451c..525efe417127 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,18 @@ +2012-10-07 Paolo Carlini + + * pt.c (fold_non_dependent_expr_sfinae): Remove static specifier. + (tsubst_copy_and_build): Use get_target_expr_sfinae. + * call.c (build_conditional_expr_1, convert_like_real): Likewise. + * cvt.c (build_up_reference): Likewise. + (ocp_convert): Use abstract_virtuals_error_sfinae. + (build_up_reference): Propagate complain to cp_build_addr_expr. + * decl.c (compute_array_index_type): Use fold_non_dependent_expr_sfinae. + * cp-tree.h: Update declarations. + + * cvt.c (build_expr_type_conversion): Tidy. + + * tree.c (stabilize_aggr_init): Change to static. + 2012-10-07 Paolo Carlini PR c++/51422 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 006cf41bc0ef..f58dc8a52e07 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -4777,7 +4777,7 @@ build_conditional_expr_1 (tree arg1, tree arg2, tree arg3, 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 (result); + result = get_target_expr_sfinae (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); @@ -5883,7 +5883,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, field = next_initializable_field (DECL_CHAIN (field)); CONSTRUCTOR_APPEND_ELT (vec, field, size_int (len)); new_ctor = build_constructor (totype, vec); - return get_target_expr (new_ctor); + return get_target_expr_sfinae (new_ctor, complain); } case ck_aggr: @@ -5899,7 +5899,8 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, return fold_if_not_in_template (expr); } expr = reshape_init (totype, expr, complain); - return get_target_expr (digest_init (totype, expr, complain)); + return get_target_expr_sfinae (digest_init (totype, expr, complain), + complain); default: break; diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 034668d8500d..00f2d4a255bc 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -5411,6 +5411,7 @@ extern tree build_non_dependent_expr (tree); extern void make_args_non_dependent (VEC(tree,gc) *); extern bool reregister_specialization (tree, tree, tree); extern tree fold_non_dependent_expr (tree); +extern tree fold_non_dependent_expr_sfinae (tree, tsubst_flags_t); extern bool alias_type_or_template_p (tree); extern bool alias_template_specialization_p (tree); extern bool explicit_class_specialization_p (tree); @@ -5700,7 +5701,6 @@ extern void lang_check_failed (const char *, int, const char *) ATTRIBUTE_NORETURN; extern tree stabilize_expr (tree, tree *); extern void stabilize_call (tree, tree *); -extern void stabilize_aggr_init (tree, tree *); extern bool stabilize_init (tree, tree *); extern tree add_stmt_to_compound (tree, tree); extern void init_tree (void); diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 86f01abf2f37..d30c7e5309e8 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -339,12 +339,12 @@ build_up_reference (tree type, tree arg, int flags, tree decl, LOOKUP_ONLYCONVERTING|DIRECT_BIND); } else if (!(flags & DIRECT_BIND) && ! lvalue_p (arg)) - return get_target_expr (arg); + return get_target_expr_sfinae (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 reference we could win better. */ - rval = cp_build_addr_expr (arg, tf_warning_or_error); + rval = cp_build_addr_expr (arg, complain); if (rval == error_mark_node) return error_mark_node; @@ -842,7 +842,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags, ctor = e; - if (abstract_virtuals_error (NULL_TREE, type)) + if (abstract_virtuals_error_sfinae (NULL_TREE, type, complain)) return error_mark_node; if (BRACE_ENCLOSED_INITIALIZER_P (ctor)) @@ -1514,8 +1514,6 @@ build_expr_type_conversion (int desires, tree expr, bool complain) "converting NULL to non-pointer type"); } - basetype = TREE_TYPE (expr); - if (basetype == error_mark_node) return error_mark_node; diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 72754a92e997..c162734cd911 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -7990,7 +7990,7 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain) NOP_EXPR with TREE_SIDE_EFFECTS; don't fold in that case. */; else { - size = fold_non_dependent_expr (size); + size = fold_non_dependent_expr_sfinae (size, complain); if (CLASS_TYPE_P (type) && CLASSTYPE_LITERAL_P (type)) diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index c3fb5e8feb27..1377b3eed520 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -5020,7 +5020,7 @@ redeclare_class_template (tree type, tree parms) /* Simplify EXPR if it is a non-dependent expression. Returns the (possibly simplified) expression. */ -static tree +tree fold_non_dependent_expr_sfinae (tree expr, tsubst_flags_t complain) { if (expr == NULL_TREE) @@ -14287,7 +14287,8 @@ tsubst_copy_and_build (tree t, FIXME stop folding in cp_parser_initializer_clause. */ gcc_assert (TREE_CONSTANT (t)); { - tree r = get_target_expr (RECUR (TARGET_EXPR_INITIAL (t))); + tree r = get_target_expr_sfinae (RECUR (TARGET_EXPR_INITIAL (t)), + complain); TREE_CONSTANT (r) = true; RETURN (r); } diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 60dc54959bb6..e1af378645a4 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -3557,7 +3557,7 @@ stabilize_call (tree call, tree *initp) arguments, while, upon return, *INITP contains an expression to compute the arguments. */ -void +static void stabilize_aggr_init (tree call, tree *initp) { tree inits = NULL_TREE;