This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] Fix ICE in cp_tree_equal (PR c++/54858)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 8 Oct 2012 21:23:26 +0200
- Subject: [C++ PATCH] Fix ICE in cp_tree_equal (PR c++/54858)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
The following testcase ICEs because cp_tree_equal doesn't handle
FIELD_DECLs (in 4.4 it was enough to have c0/d0 and c1/d1 in the testcase,
now 12 lines are needed due to introduction of a hash table).
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
ok for trunk/4.7?
2012-10-08 Jakub Jelinek <jakub@redhat.com>
PR c++/54858
* tree.c (cp_tree_equal): Handle FIELD_DECL.
* g++.dg/template/crash113.C: New test.
--- gcc/cp/tree.c.jj 2012-10-05 21:26:54.000000000 +0200
+++ gcc/cp/tree.c 2012-10-08 18:19:00.897543649 +0200
@@ -2559,6 +2559,7 @@ cp_tree_equal (tree t1, tree t2)
case VAR_DECL:
case CONST_DECL:
+ case FIELD_DECL:
case FUNCTION_DECL:
case TEMPLATE_DECL:
case IDENTIFIER_NODE:
--- gcc/testsuite/g++.dg/template/pr54858.C.jj 2012-10-08 18:15:55.470586784 +0200
+++ gcc/testsuite/g++.dg/template/pr54858.C 2012-10-08 18:14:28.000000000 +0200
@@ -0,0 +1,21 @@
+// PR c++/54858
+// { dg-do compile }
+
+template <int> struct A {};
+template <typename T, T *> struct B {};
+template <typename D> struct C
+{
+ A<0> c0; B<A<0>, &C::c0> d0; // { dg-error "could not convert template argument" }
+ A<0> c1; B<A<0>, &C::c1> d1; // { dg-error "could not convert template argument" }
+ A<0> c2; B<A<0>, &C::c2> d2; // { dg-error "could not convert template argument" }
+ A<0> c3; B<A<0>, &C::c3> d3; // { dg-error "could not convert template argument" }
+ A<0> c4; B<A<0>, &C::c4> d4; // { dg-error "could not convert template argument" }
+ A<0> c5; B<A<0>, &C::c5> d5; // { dg-error "could not convert template argument" }
+ A<0> c6; B<A<0>, &C::c6> d6; // { dg-error "could not convert template argument" }
+ A<0> c7; B<A<0>, &C::c7> d7; // { dg-error "could not convert template argument" }
+ A<0> c8; B<A<0>, &C::c8> d8; // { dg-error "could not convert template argument" }
+ A<0> c9; B<A<0>, &C::c9> d9; // { dg-error "could not convert template argument" }
+ A<0> ca; B<A<0>, &C::ca> da; // { dg-error "could not convert template argument" }
+ A<0> cb; B<A<0>, &C::cb> db; // { dg-error "could not convert template argument" }
+};
+C<int> e;
Jakub