+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
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);
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:
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;
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);
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);
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;
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))
"converting NULL to non-pointer type");
}
- basetype = TREE_TYPE (expr);
-
if (basetype == error_mark_node)
return error_mark_node;
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))
/* 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)
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);
}
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;