summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsimartin <simartin@138bc75d-0d04-0410-961f-82ee72b054a4>2007-01-11 19:46:03 +0000
committersimartin <simartin@138bc75d-0d04-0410-961f-82ee72b054a4>2007-01-11 19:46:03 +0000
commitbb3141cba23451798460261ff54c1805179e1646 (patch)
tree0f3c51fe1f2b8c17b0a809798e495fd93772cedd
parentec79f74bfcd22884065db103c3469a27789f98b1 (diff)
downloadgcc-bb3141cba23451798460261ff54c1805179e1646.tar.gz
2007-01-11 Simon Martin <simartin@users.sourceforge.net>
PR c++/29573 * tree.c (cp_tree_equal): Properly handle MODOP_EXPR trees. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120683 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/tree.c15
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/sizeof-template-argument.C15
4 files changed, 40 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 74af04ca5c5..12a3cc62680 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2007-01-11 Simon Martin <simartin@users.sourceforge.net>
+
+ PR c++/29573
+ * tree.c (cp_tree_equal): Properly handle MODOP_EXPR trees.
+
2007-01-10 Mark Mitchell <mark@codesourcery.com>
PR c++/28999
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index ae3dc4c2786..742e09014e3 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1709,6 +1709,21 @@ cp_tree_equal (tree t1, tree t2)
return cp_tree_equal (o1, o2);
}
+ case MODOP_EXPR:
+ {
+ tree t1_op1, t2_op1;
+
+ if (!cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0)))
+ return false;
+
+ t1_op1 = TREE_OPERAND (t1, 1);
+ t2_op1 = TREE_OPERAND (t2, 1);
+ if (TREE_CODE (t1_op1) != TREE_CODE (t2_op1))
+ return false;
+
+ return cp_tree_equal (TREE_OPERAND (t1, 2), TREE_OPERAND (t2, 2));
+ }
+
case PTRMEM_CST:
/* Two pointer-to-members are the same if they point to the same
field or function in the same class. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c63f07418b7..7b9b3757380 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-01-11 Simon Martin <simartin@users.sourceforge.net>
+
+ PR c++/29573
+ * g++.dg/template/sizeof-template-argument.C: New test.
+
2007-01-11 Jan Hubicka <jh@suse.cz>
* gcc.dg/tree-ssa/tailrecursion-4.c: Update dump file.
diff --git a/gcc/testsuite/g++.dg/template/sizeof-template-argument.C b/gcc/testsuite/g++.dg/template/sizeof-template-argument.C
new file mode 100644
index 00000000000..f7472c3c1a1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/sizeof-template-argument.C
@@ -0,0 +1,15 @@
+/* This used to ICE (PR c++/29573) */
+/* { dg-do "compile" } */
+
+template<int> struct A {};
+
+template<typename> struct B : A <sizeof(=)> {}; /* { dg-error "parse error in template argument list" } */
+
+template<typename> struct C : A <sizeof(=)> {}; /* { dg-error "parse error in template argument list" } */
+
+int a;
+
+template<typename> struct D : A <sizeof(a=1)> {}; /* This used to ICE as well. */
+
+template<typename> struct E : A <sizeof(a=1)> {}; /* This used to ICE as well. */
+