Commit 81bd268c by Paolo Carlini Committed by Paolo Carlini

pt.c (fold_non_dependent_expr_sfinae): Remove static specifier.

2012-10-07  Paolo Carlini  <paolo.carlini@oracle.com>

	* 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
parent a5061eed
2012-10-07 Paolo Carlini <paolo.carlini@oracle.com>
* 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 <paolo.carlini@oracle.com>
PR c++/51422
* semantics.c (is_normal_capture_proxy): Return true for
error_mark_node as DECL_VALUE_EXPR.
......
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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))
......
......@@ -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);
}
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment