tree.c (build_target_expr): Set TREE_CONSTANT on literal TARGET_EXPR if the value is constant.
* tree.c (build_target_expr): Set TREE_CONSTANT on literal TARGET_EXPR if the value is constant. * typeck2.c (build_functional_cast): Don't set it here. From-SVN: r177997
This commit is contained in:
parent
27bec7bf4a
commit
30fdd4f2bf
@ -1,3 +1,9 @@
|
|||||||
|
2011-08-23 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
|
* tree.c (build_target_expr): Set TREE_CONSTANT on
|
||||||
|
literal TARGET_EXPR if the value is constant.
|
||||||
|
* typeck2.c (build_functional_cast): Don't set it here.
|
||||||
|
|
||||||
2011-08-23 Jason Merrill <jason@redhat.com>
|
2011-08-23 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
Core 903 (partial)
|
Core 903 (partial)
|
||||||
|
@ -288,6 +288,7 @@ static tree
|
|||||||
build_target_expr (tree decl, tree value, tsubst_flags_t complain)
|
build_target_expr (tree decl, tree value, tsubst_flags_t complain)
|
||||||
{
|
{
|
||||||
tree t;
|
tree t;
|
||||||
|
tree type = TREE_TYPE (decl);
|
||||||
|
|
||||||
#ifdef ENABLE_CHECKING
|
#ifdef ENABLE_CHECKING
|
||||||
gcc_assert (VOID_TYPE_P (TREE_TYPE (value))
|
gcc_assert (VOID_TYPE_P (TREE_TYPE (value))
|
||||||
@ -302,12 +303,14 @@ build_target_expr (tree decl, tree value, tsubst_flags_t complain)
|
|||||||
t = cxx_maybe_build_cleanup (decl, complain);
|
t = cxx_maybe_build_cleanup (decl, complain);
|
||||||
if (t == error_mark_node)
|
if (t == error_mark_node)
|
||||||
return error_mark_node;
|
return error_mark_node;
|
||||||
t = build4 (TARGET_EXPR, TREE_TYPE (decl), decl, value, t, NULL_TREE);
|
t = build4 (TARGET_EXPR, type, decl, value, t, NULL_TREE);
|
||||||
/* We always set TREE_SIDE_EFFECTS so that expand_expr does not
|
/* We always set TREE_SIDE_EFFECTS so that expand_expr does not
|
||||||
ignore the TARGET_EXPR. If there really turn out to be no
|
ignore the TARGET_EXPR. If there really turn out to be no
|
||||||
side-effects, then the optimizer should be able to get rid of
|
side-effects, then the optimizer should be able to get rid of
|
||||||
whatever code is generated anyhow. */
|
whatever code is generated anyhow. */
|
||||||
TREE_SIDE_EFFECTS (t) = 1;
|
TREE_SIDE_EFFECTS (t) = 1;
|
||||||
|
if (literal_type_p (type))
|
||||||
|
TREE_CONSTANT (t) = TREE_CONSTANT (value);
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
@ -1684,9 +1684,6 @@ build_functional_cast (tree exp, tree parms, tsubst_flags_t complain)
|
|||||||
{
|
{
|
||||||
exp = build_value_init (type, complain);
|
exp = build_value_init (type, complain);
|
||||||
exp = get_target_expr_sfinae (exp, complain);
|
exp = get_target_expr_sfinae (exp, complain);
|
||||||
/* FIXME this is wrong */
|
|
||||||
if (literal_type_p (type))
|
|
||||||
TREE_CONSTANT (exp) = true;
|
|
||||||
return exp;
|
return exp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user