diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2004-12-16 11:04:09 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2004-12-16 11:04:09 +0000 |
commit | 8a784e4a1772379577b0fe91de4b387390573435 (patch) | |
tree | a82d5b1b25a2b0a52f0c9e6f96bfb4fbbb2d9e1c /gcc/cp/cvt.c | |
parent | 0c0cce420e1ced4cfd4e6daddb91e3f6b548bf29 (diff) | |
download | gcc-8a784e4a1772379577b0fe91de4b387390573435.tar.gz |
re PR c++/18905 (Strange error: subscripted value is neither array nor pointer)
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.
From-SVN: r92257
Diffstat (limited to 'gcc/cp/cvt.c')
-rw-r--r-- | gcc/cp/cvt.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 7039bfe6fd0..2d73ab85698 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -621,7 +621,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags) complete_type (type); complete_type (TREE_TYPE (expr)); - e = decl_constant_value (e); + e = integral_constant_value (e); if (IS_AGGR_TYPE (type) && (convtype & CONV_FORCE_TEMP) /* Some internal structures (vtable_entry_type, sigtbl_ptr_type) @@ -945,10 +945,7 @@ convert (tree type, tree expr) intype = TREE_TYPE (expr); if (POINTER_TYPE_P (type) && POINTER_TYPE_P (intype)) - { - expr = decl_constant_value (expr); - return fold_if_not_in_template (build_nop (type, expr)); - } + return fold_if_not_in_template (build_nop (type, expr)); return ocp_convert (type, expr, CONV_OLD_CONVERT, LOOKUP_NORMAL|LOOKUP_NO_CONVERSION); |