aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2004-12-16 11:04:09 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2004-12-16 11:04:09 +0000
commit8a784e4a1772379577b0fe91de4b387390573435 (patch)
treea82d5b1b25a2b0a52f0c9e6f96bfb4fbbb2d9e1c /gcc/testsuite/g++.dg
parent0c0cce420e1ced4cfd4e6daddb91e3f6b548bf29 (diff)
downloadgcc-8a784e4a1772379577b0fe91de4b387390573435.zip
gcc-8a784e4a1772379577b0fe91de4b387390573435.tar.gz
gcc-8a784e4a1772379577b0fe91de4b387390573435.tar.bz2
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/testsuite/g++.dg')
-rw-r--r--gcc/testsuite/g++.dg/opt/static3.C1
-rw-r--r--gcc/testsuite/g++.dg/template/init4.C15
2 files changed, 16 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/opt/static3.C b/gcc/testsuite/g++.dg/opt/static3.C
index 00c7265..4f8f7a9 100644
--- a/gcc/testsuite/g++.dg/opt/static3.C
+++ b/gcc/testsuite/g++.dg/opt/static3.C
@@ -1,4 +1,5 @@
// { dg-do link }
+// { dg-options "-O2" }
class Foo {
public:
diff --git a/gcc/testsuite/g++.dg/template/init4.C b/gcc/testsuite/g++.dg/template/init4.C
new file mode 100644
index 0000000..78c7c30
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/init4.C
@@ -0,0 +1,15 @@
+// { dg-do compile }
+
+// Copyright (C) 2004 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 15 Dec 2004 <nathan@codesourcery.com>
+
+// PR 18905. bogus error
+// Origin: Andrew Pinski <pinskia@gcc.gnu.org>
+
+int f1(char);
+template <int t>
+void f(void)
+{
+ const char* const suffixes = "plpv";
+ f1(suffixes[t]);
+}