summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/tree.c4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/parse/template23.C10
4 files changed, 24 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 5349dc4abde..8f6d6deb40c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2007-03-04 Simon Martin <simartin@users.sourceforge.net>
+
+ PR c++/30895
+ * tree.c (cp_tree_equal): Properly handle COMPLEX_CST trees.
+
2007-03-03 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c++/15787
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index a5fac298007..b7e1d0f7dcc 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1670,6 +1670,10 @@ cp_tree_equal (tree t1, tree t2)
&& !memcmp (TREE_STRING_POINTER (t1), TREE_STRING_POINTER (t2),
TREE_STRING_LENGTH (t1));
+ case COMPLEX_CST:
+ return cp_tree_equal (TREE_REALPART (t1), TREE_REALPART (t2))
+ && cp_tree_equal (TREE_IMAGPART (t1), TREE_IMAGPART (t2));
+
case CONSTRUCTOR:
/* We need to do this when determining whether or not two
non-type pointer to member function template arguments
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d469c95e120..258f2f2cfa0 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-03-04 Simon Martin <simartin@users.sourceforge.net>
+
+ PR c++/30895
+ * g++.dg/parse/template23.C: New test.
+
2007-03-04 Roger Sayle <roger@eyesopen.com>
PR middle-end/30744
diff --git a/gcc/testsuite/g++.dg/parse/template23.C b/gcc/testsuite/g++.dg/parse/template23.C
new file mode 100644
index 00000000000..795457b68da
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/template23.C
@@ -0,0 +1,10 @@
+/* PR c++/30895 This used to ICE. */
+/* { dg-do "compile" } */
+
+template<int> struct A {};
+
+template<typename T> struct B
+{
+ A<T(0i)> a1; /* { dg-error "imaginary constants are a GCC extension" } */
+ A<T(0i)> a2; /* { dg-error "imaginary constants are a GCC extension" } */
+};