re PR c++/48450 ([C++0x][SFINAE] Hard errors with static_cast expressions)
PR c++/48450 * tree.c (build_cplus_new, build_aggr_init_expr): Take complain. (bot_manip): Adjust. * cp-tree.h: Adjust. * call.c (convert_like_real, build_cxx_call): Adjust. (perform_direct_initialization_if_possible): Adjust. * cvt.c (ocp_convert): Adjust. * init.c (build_value_init): Adjust. * semantics.c (maybe_add_lambda_conv_op): Adjust. * typeck.c (unary_complex_lvalue, cp_build_modify_expr): Adjust. * typeck2.c (build_functional_cast): Adjust. From-SVN: r172143
This commit is contained in:
parent
351ccf209e
commit
362115a912
@ -1,5 +1,17 @@
|
|||||||
2011-04-07 Jason Merrill <jason@redhat.com>
|
2011-04-07 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
|
PR c++/48450
|
||||||
|
* tree.c (build_cplus_new, build_aggr_init_expr): Take complain.
|
||||||
|
(bot_manip): Adjust.
|
||||||
|
* cp-tree.h: Adjust.
|
||||||
|
* call.c (convert_like_real, build_cxx_call): Adjust.
|
||||||
|
(perform_direct_initialization_if_possible): Adjust.
|
||||||
|
* cvt.c (ocp_convert): Adjust.
|
||||||
|
* init.c (build_value_init): Adjust.
|
||||||
|
* semantics.c (maybe_add_lambda_conv_op): Adjust.
|
||||||
|
* typeck.c (unary_complex_lvalue, cp_build_modify_expr): Adjust.
|
||||||
|
* typeck2.c (build_functional_cast): Adjust.
|
||||||
|
|
||||||
* init.c (build_value_init_noctor): Handle REFERENCE_TYPE at top
|
* init.c (build_value_init_noctor): Handle REFERENCE_TYPE at top
|
||||||
level.
|
level.
|
||||||
(perform_member_init): Not here.
|
(perform_member_init): Not here.
|
||||||
|
@ -5414,7 +5414,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
|
|||||||
we need to build up a TARGET_EXPR. */
|
we need to build up a TARGET_EXPR. */
|
||||||
if (DECL_CONSTRUCTOR_P (convfn))
|
if (DECL_CONSTRUCTOR_P (convfn))
|
||||||
{
|
{
|
||||||
expr = build_cplus_new (totype, expr);
|
expr = build_cplus_new (totype, expr, complain);
|
||||||
|
|
||||||
/* Remember that this was list-initialization. */
|
/* Remember that this was list-initialization. */
|
||||||
if (convs->check_narrowing)
|
if (convs->check_narrowing)
|
||||||
@ -5559,7 +5559,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
|
|||||||
else if (diag_kind == DK_ERROR)
|
else if (diag_kind == DK_ERROR)
|
||||||
return error_mark_node;
|
return error_mark_node;
|
||||||
}
|
}
|
||||||
return build_cplus_new (totype, expr);
|
return build_cplus_new (totype, expr, complain);
|
||||||
|
|
||||||
case ck_ref_bind:
|
case ck_ref_bind:
|
||||||
{
|
{
|
||||||
@ -6476,7 +6476,7 @@ build_cxx_call (tree fn, int nargs, tree *argarray)
|
|||||||
return error_mark_node;
|
return error_mark_node;
|
||||||
|
|
||||||
if (MAYBE_CLASS_TYPE_P (TREE_TYPE (fn)))
|
if (MAYBE_CLASS_TYPE_P (TREE_TYPE (fn)))
|
||||||
fn = build_cplus_new (TREE_TYPE (fn), fn);
|
fn = build_cplus_new (TREE_TYPE (fn), fn, tf_warning_or_error);
|
||||||
return convert_from_reference (fn);
|
return convert_from_reference (fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8119,7 +8119,7 @@ perform_direct_initialization_if_possible (tree type,
|
|||||||
expr = build_special_member_call (NULL_TREE, complete_ctor_identifier,
|
expr = build_special_member_call (NULL_TREE, complete_ctor_identifier,
|
||||||
&args, type, LOOKUP_NORMAL, complain);
|
&args, type, LOOKUP_NORMAL, complain);
|
||||||
release_tree_vector (args);
|
release_tree_vector (args);
|
||||||
return build_cplus_new (type, expr);
|
return build_cplus_new (type, expr, complain);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the high-water mark for the CONVERSION_OBSTACK. */
|
/* Get the high-water mark for the CONVERSION_OBSTACK. */
|
||||||
|
@ -5395,8 +5395,8 @@ extern tree build_min (enum tree_code, tree, ...);
|
|||||||
extern tree build_min_nt (enum tree_code, ...);
|
extern tree build_min_nt (enum tree_code, ...);
|
||||||
extern tree build_min_non_dep (enum tree_code, tree, ...);
|
extern tree build_min_non_dep (enum tree_code, tree, ...);
|
||||||
extern tree build_min_non_dep_call_vec (tree, tree, VEC(tree,gc) *);
|
extern tree build_min_non_dep_call_vec (tree, tree, VEC(tree,gc) *);
|
||||||
extern tree build_cplus_new (tree, tree);
|
extern tree build_cplus_new (tree, tree, tsubst_flags_t);
|
||||||
extern tree build_aggr_init_expr (tree, tree);
|
extern tree build_aggr_init_expr (tree, tree, tsubst_flags_t);
|
||||||
extern tree get_target_expr (tree);
|
extern tree get_target_expr (tree);
|
||||||
extern tree build_cplus_array_type (tree, tree);
|
extern tree build_cplus_array_type (tree, tree);
|
||||||
extern tree build_array_of_n_type (tree, int);
|
extern tree build_array_of_n_type (tree, int);
|
||||||
|
@ -819,7 +819,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags)
|
|||||||
release_tree_vector (ctor_vec);
|
release_tree_vector (ctor_vec);
|
||||||
}
|
}
|
||||||
if (ctor)
|
if (ctor)
|
||||||
return build_cplus_new (type, ctor);
|
return build_cplus_new (type, ctor, tf_warning_or_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & LOOKUP_COMPLAIN)
|
if (flags & LOOKUP_COMPLAIN)
|
||||||
|
@ -342,7 +342,8 @@ build_value_init (tree type, tsubst_flags_t complain)
|
|||||||
(type,
|
(type,
|
||||||
build_special_member_call (NULL_TREE, complete_ctor_identifier,
|
build_special_member_call (NULL_TREE, complete_ctor_identifier,
|
||||||
NULL, type, LOOKUP_NORMAL,
|
NULL, type, LOOKUP_NORMAL,
|
||||||
complain));
|
complain),
|
||||||
|
complain);
|
||||||
else if (TREE_CODE (type) != UNION_TYPE && TYPE_NEEDS_CONSTRUCTING (type))
|
else if (TREE_CODE (type) != UNION_TYPE && TYPE_NEEDS_CONSTRUCTING (type))
|
||||||
{
|
{
|
||||||
/* This is a class that needs constructing, but doesn't have
|
/* This is a class that needs constructing, but doesn't have
|
||||||
@ -354,7 +355,7 @@ build_value_init (tree type, tsubst_flags_t complain)
|
|||||||
NULL, type, LOOKUP_NORMAL, complain);
|
NULL, type, LOOKUP_NORMAL, complain);
|
||||||
if (ctor != error_mark_node)
|
if (ctor != error_mark_node)
|
||||||
{
|
{
|
||||||
ctor = build_aggr_init_expr (type, ctor);
|
ctor = build_aggr_init_expr (type, ctor, complain);
|
||||||
AGGR_INIT_ZERO_FIRST (ctor) = 1;
|
AGGR_INIT_ZERO_FIRST (ctor) = 1;
|
||||||
}
|
}
|
||||||
return ctor;
|
return ctor;
|
||||||
|
@ -8429,7 +8429,7 @@ maybe_add_lambda_conv_op (tree type)
|
|||||||
VEC_address (tree, argvec));
|
VEC_address (tree, argvec));
|
||||||
CALL_FROM_THUNK_P (call) = 1;
|
CALL_FROM_THUNK_P (call) = 1;
|
||||||
if (MAYBE_CLASS_TYPE_P (TREE_TYPE (call)))
|
if (MAYBE_CLASS_TYPE_P (TREE_TYPE (call)))
|
||||||
call = build_cplus_new (TREE_TYPE (call), call);
|
call = build_cplus_new (TREE_TYPE (call), call, tf_warning_or_error);
|
||||||
call = convert_from_reference (call);
|
call = convert_from_reference (call);
|
||||||
finish_return_stmt (call);
|
finish_return_stmt (call);
|
||||||
|
|
||||||
|
@ -373,7 +373,7 @@ build_aggr_init_array (tree return_type, tree fn, tree slot, int nargs,
|
|||||||
callable. */
|
callable. */
|
||||||
|
|
||||||
tree
|
tree
|
||||||
build_aggr_init_expr (tree type, tree init)
|
build_aggr_init_expr (tree type, tree init, tsubst_flags_t complain)
|
||||||
{
|
{
|
||||||
tree fn;
|
tree fn;
|
||||||
tree slot;
|
tree slot;
|
||||||
@ -382,7 +382,9 @@ build_aggr_init_expr (tree type, tree init)
|
|||||||
|
|
||||||
/* Make sure that we're not trying to create an instance of an
|
/* Make sure that we're not trying to create an instance of an
|
||||||
abstract class. */
|
abstract class. */
|
||||||
abstract_virtuals_error (NULL_TREE, type);
|
if (abstract_virtuals_error_sfinae (NULL_TREE, type, complain)
|
||||||
|
&& !(complain & tf_error))
|
||||||
|
return error_mark_node;
|
||||||
|
|
||||||
if (TREE_CODE (init) == CALL_EXPR)
|
if (TREE_CODE (init) == CALL_EXPR)
|
||||||
fn = CALL_EXPR_FN (init);
|
fn = CALL_EXPR_FN (init);
|
||||||
@ -437,9 +439,9 @@ build_aggr_init_expr (tree type, tree init)
|
|||||||
and language-specific expression expanders. */
|
and language-specific expression expanders. */
|
||||||
|
|
||||||
tree
|
tree
|
||||||
build_cplus_new (tree type, tree init)
|
build_cplus_new (tree type, tree init, tsubst_flags_t complain)
|
||||||
{
|
{
|
||||||
tree rval = build_aggr_init_expr (type, init);
|
tree rval = build_aggr_init_expr (type, init, complain);
|
||||||
tree slot;
|
tree slot;
|
||||||
|
|
||||||
if (TREE_CODE (rval) == AGGR_INIT_EXPR)
|
if (TREE_CODE (rval) == AGGR_INIT_EXPR)
|
||||||
@ -1805,7 +1807,8 @@ bot_manip (tree* tp, int* walk_subtrees, void* data)
|
|||||||
tree u;
|
tree u;
|
||||||
|
|
||||||
if (TREE_CODE (TREE_OPERAND (t, 1)) == AGGR_INIT_EXPR)
|
if (TREE_CODE (TREE_OPERAND (t, 1)) == AGGR_INIT_EXPR)
|
||||||
u = build_cplus_new (TREE_TYPE (t), TREE_OPERAND (t, 1));
|
u = build_cplus_new (TREE_TYPE (t), TREE_OPERAND (t, 1),
|
||||||
|
tf_warning_or_error);
|
||||||
else
|
else
|
||||||
u = build_target_expr_with_type (TREE_OPERAND (t, 1), TREE_TYPE (t));
|
u = build_target_expr_with_type (TREE_OPERAND (t, 1), TREE_TYPE (t));
|
||||||
|
|
||||||
|
@ -5320,7 +5320,7 @@ unary_complex_lvalue (enum tree_code code, tree arg)
|
|||||||
if (TREE_CODE (arg) == SAVE_EXPR)
|
if (TREE_CODE (arg) == SAVE_EXPR)
|
||||||
targ = arg;
|
targ = arg;
|
||||||
else
|
else
|
||||||
targ = build_cplus_new (TREE_TYPE (arg), arg);
|
targ = build_cplus_new (TREE_TYPE (arg), arg, tf_warning_or_error);
|
||||||
return build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (arg)), targ);
|
return build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (arg)), targ);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6742,7 +6742,7 @@ cp_build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs,
|
|||||||
{
|
{
|
||||||
if (TREE_CODE (newrhs) == CALL_EXPR
|
if (TREE_CODE (newrhs) == CALL_EXPR
|
||||||
&& TYPE_NEEDS_CONSTRUCTING (lhstype))
|
&& TYPE_NEEDS_CONSTRUCTING (lhstype))
|
||||||
newrhs = build_cplus_new (lhstype, newrhs);
|
newrhs = build_cplus_new (lhstype, newrhs, complain);
|
||||||
|
|
||||||
/* Can't initialize directly from a TARGET_EXPR, since that would
|
/* Can't initialize directly from a TARGET_EXPR, since that would
|
||||||
cause the lhs to be constructed twice, and possibly result in
|
cause the lhs to be constructed twice, and possibly result in
|
||||||
|
@ -1614,7 +1614,7 @@ build_functional_cast (tree exp, tree parms, tsubst_flags_t complain)
|
|||||||
if (exp == error_mark_node)
|
if (exp == error_mark_node)
|
||||||
return error_mark_node;
|
return error_mark_node;
|
||||||
|
|
||||||
return build_cplus_new (type, exp);
|
return build_cplus_new (type, exp, complain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user