aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-03-11 11:49:41 -0500
committerJason Merrill <jason@gcc.gnu.org>2011-03-11 11:49:41 -0500
commite8d6ec55fd0e42332ef3014312c5b139c20d0fa8 (patch)
tree2f7ae9f6f328255d6116b239ee49e367364f369e
parenta758fd670cbf0935c6fa6cac3336b184f5c3c92a (diff)
downloadgcc-e8d6ec55fd0e42332ef3014312c5b139c20d0fa8.zip
gcc-e8d6ec55fd0e42332ef3014312c5b139c20d0fa8.tar.gz
gcc-e8d6ec55fd0e42332ef3014312c5b139c20d0fa8.tar.bz2
re PR c++/47808 ([C++0x] internal compiler error: in tsubst_copy_and_build, at cp/pt.c:13326)
PR c++/47808 * decl.c (compute_array_index_type): Discard folding if it didn't produce a constant. From-SVN: r170878
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c2
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/regress/array1.C16
4 files changed, 28 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index da75a77..29156ef 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2011-03-11 Jason Merrill <jason@redhat.com>
+
+ PR c++/47808
+ * decl.c (compute_array_index_type): Discard folding
+ if it didn't produce a constant.
+
2011-03-11 Jakub Jelinek <jakub@redhat.com>
PR c++/48035
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 93c1848..f9d90ad 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -7523,6 +7523,8 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain)
}
size = maybe_constant_value (size);
+ if (!TREE_CONSTANT (size))
+ size = osize;
}
if (error_operand_p (size))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5976bb4..cf7d6d8 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2011-03-11 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp0x/regress/array1.C: New.
+
2011-03-11 Richard Guenther <rguenther@suse.de>
PR tree-optimization/48067
diff --git a/gcc/testsuite/g++.dg/cpp0x/regress/array1.C b/gcc/testsuite/g++.dg/cpp0x/regress/array1.C
new file mode 100644
index 0000000..629ab41
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/regress/array1.C
@@ -0,0 +1,16 @@
+// PR c++/47808
+// { dg-options -std=c++0x }
+
+template <typename T>
+inline T abs (T const & x) { return x; }
+
+template <typename T>
+void f (T)
+{
+ typedef int ai[(abs(0.1) > 0) ? 1 : -1];
+}
+
+int main()
+{
+ f(1);
+}