aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2011-12-06 20:52:39 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2011-12-06 20:52:39 +0100
commit0e642d0671db79acb4bccc4268e461fdcf5c1cdf (patch)
treeb73630ddbd299c29d5c1d121f23b1a0ac0a629cc /gcc
parent70d63e488355f52bf768bd1d9d091d9fff4a82d3 (diff)
downloadgcc-0e642d0671db79acb4bccc4268e461fdcf5c1cdf.zip
gcc-0e642d0671db79acb4bccc4268e461fdcf5c1cdf.tar.gz
gcc-0e642d0671db79acb4bccc4268e461fdcf5c1cdf.tar.bz2
re PR c++/51430 (ICE with array as static const member)
PR c++/51430 * pt.c (tsubst_decl): Don't call strip_array_domain on error_mark_node. * g++.dg/template/static32.C: New test. From-SVN: r182063
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/static32.C9
4 files changed, 23 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f979af5..defc0a5 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2011-12-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/51430
+ * pt.c (tsubst_decl): Don't call strip_array_domain on
+ error_mark_node.
+
2011-12-06 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51431
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 15ef7a0..7603c11 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -10622,7 +10622,9 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
type = DECL_ORIGINAL_TYPE (t);
else
type = TREE_TYPE (t);
- if (TREE_CODE (t) == VAR_DECL && VAR_HAD_UNKNOWN_BOUND (t))
+ if (TREE_CODE (t) == VAR_DECL
+ && VAR_HAD_UNKNOWN_BOUND (t)
+ && type != error_mark_node)
type = strip_array_domain (type);
type = tsubst (type, args, complain, in_decl);
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2353dd9..507f9df 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2011-12-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/51430
+ * g++.dg/template/static32.C: New test.
+
2011-12-06 Uros Bizjak <ubizjak@gmail.com>
* g++.dg/opt/pr51396.C: Use dg-additional-options.
diff --git a/gcc/testsuite/g++.dg/template/static32.C b/gcc/testsuite/g++.dg/template/static32.C
new file mode 100644
index 0000000..b17d14d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/static32.C
@@ -0,0 +1,9 @@
+// PR c++/51430
+// { dg-do compile }
+
+template<int> struct A
+{
+ static const int x[] = 0; // { dg-error "in-class initialization|initializer fails" }
+};
+
+A<0> a;