summaryrefslogtreecommitdiff
path: root/gcc/cp/call.c
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-16 11:04:09 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-16 11:04:09 +0000
commit13f0eb203f1c4d5cfb52f559ab84725160d89f2e (patch)
treea82d5b1b25a2b0a52f0c9e6f96bfb4fbbb2d9e1c /gcc/cp/call.c
parent0f2bc8a91019330220f928f3709c06a684b9606c (diff)
downloadgcc-13f0eb203f1c4d5cfb52f559ab84725160d89f2e.tar.gz
cp:
PR c++/18905 * cp-tree.h (integral_constant_value): Declare. * call.c (null_ptr_cst_p): Use integral_constant_value, not decl_constant_value. (convert_like_real): Likewise. * class.c (check_bitfield_decl): Likewise. * cvt.c (ocp_convert): Likewise. (convert): Remove unnecessary decl_constant_value call. * decl.c (compute_array_index_type): Use integral_constant_value, not decl_constant_value. (build_enumerator): Likewise. * decl2.c (grokfield): Likewise. * init.c (decl_constant_value): Simplify. (integral_constant_value): New. * pt.c (fold_decl_constant_value): Use integral_constant_value, remove subsequent check. (tsubst): Use integral_constant_value, not decl_constant_value. (tsubst_copy, unify): Likewise. * typeck.c (decay_conversion): Likewise. (build_compound_expr): Remove unnecessary decl_constant_value calls. (build_static_cast_1, build_reinterpret_cast_1): (convert_for_assignment): Remove comment about not calling decl_constant_value. testsuite: PR c++/18905 * g++.dg/template/init4.C: New. * g++.dg/opt/static3.C: Enable optimizer. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@92257 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r--gcc/cp/call.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index ab31c99a51e..af6f7d82258 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -428,8 +428,7 @@ null_ptr_cst_p (tree t)
A null pointer constant is an integral constant expression
(_expr.const_) rvalue of integer type that evaluates to zero. */
- if (DECL_INTEGRAL_CONSTANT_VAR_P (t))
- t = decl_constant_value (t);
+ t = integral_constant_value (t);
if (t == null_node
|| (CP_INTEGRAL_TYPE_P (TREE_TYPE (t)) && integer_zerop (t)))
return true;
@@ -4227,12 +4226,11 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
case ck_identity:
if (type_unknown_p (expr))
expr = instantiate_type (totype, expr, tf_error | tf_warning);
- /* Convert a non-array constant variable to its underlying value, unless we
- are about to bind it to a reference, in which case we need to
+ /* Convert a constant to its underlying value, unless we are
+ about to bind it to a reference, in which case we need to
leave it as an lvalue. */
- if (inner >= 0
- && TREE_CODE (TREE_TYPE (expr)) != ARRAY_TYPE)
- expr = decl_constant_value (expr);
+ if (inner >= 0)
+ expr = integral_constant_value (expr);
if (convs->check_copy_constructor_p)
check_constructor_callable (totype, expr);
return expr;