aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Martin <simartin@users.sourceforge.net>2007-04-17 18:05:53 +0000
committerSimon Martin <simartin@gcc.gnu.org>2007-04-17 18:05:53 +0000
commitf01ec37df9e2d75b027fa7fb2bc8738a5c6f580c (patch)
treeb91c0bec7d5fbfcd24aa2baf2e8cda6541b0a31b
parentce217d7583aa0d4817c10126f42cffbe1f8ee2d2 (diff)
downloadgcc-f01ec37df9e2d75b027fa7fb2bc8738a5c6f580c.zip
gcc-f01ec37df9e2d75b027fa7fb2bc8738a5c6f580c.tar.gz
gcc-f01ec37df9e2d75b027fa7fb2bc8738a5c6f580c.tar.bz2
re PR c++/31517 (ICE on invalid initialization of static member of a template class)
2007-04-17 Simon Martin <simartin@users.sourceforge.net> PR c++/31517 * pt.c (value_dependent_expression_p): Handle MODOP_EXPRs. From-SVN: r123923
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/pt.c4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/init7.C9
4 files changed, 23 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f23256a..1b7172f 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2007-04-17 Simon Martin <simartin@users.sourceforge.net>
+
+ PR c++/31517
+ * pt.c (value_dependent_expression_p): Handle MODOP_EXPRs.
+
2007-04-16 Seongbae Park <seongbae.park@gmail.com>
PR c++/29365
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 906b8d5..05d7752 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -14949,6 +14949,10 @@ value_dependent_expression_p (tree expression)
|| (type2 ? dependent_type_p (type2) : false));
}
+ case MODOP_EXPR:
+ return ((value_dependent_expression_p (TREE_OPERAND (expression, 0)))
+ || (value_dependent_expression_p (TREE_OPERAND (expression, 2))));
+
default:
/* A constant expression is value-dependent if any subexpression is
value-dependent. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 36592ab..bb25db0 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-04-17 Simon Martin <simartin@users.sourceforge.net>
+
+ PR c++/31517
+ * g++.dg/template/init7.C: New test.
+
2007-04-17 Zdenek Dvorak <dvorakz@suse.cz>
PR rtl-optimization/31360
diff --git a/gcc/testsuite/g++.dg/template/init7.C b/gcc/testsuite/g++.dg/template/init7.C
new file mode 100644
index 0000000..e226776
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/init7.C
@@ -0,0 +1,9 @@
+/* PR c++/31517. This used to ICE. */
+/* { dg-do "compile" } */
+
+template<typename> struct A
+{
+ static const int i=0;
+};
+
+template<typename T> const int A<T>::i = 0=0; /* { dg-error "duplicate initialization" } */