This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] Fix lookup_conversions_r (4.0/4.1/4.2 regression)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Nathan Sidwell <nathan at codesourcery dot com>, Mark Mitchell <mark at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 17 Jan 2006 10:52:12 -0500
- Subject: [C++ PATCH] Fix lookup_conversions_r (4.0/4.1/4.2 regression)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
On the attached testcase we ICE in lookup_conversions_r, parent_convs is
NULL. The code was introduced by Nathan for 4.0+ with
http://gcc.gnu.org/ml/gcc-patches/2004-07/msg02102.html
and to me, without deep understanding what exactly it is doing, it
looks like a pasto from a few lines above it and indeed changing it
fixes the testcase.
Is my guess right (I'm really not familiar with that part of C+ FE)?
If so, is this ok for 4.0/4.1/trunk after testing?
2006-01-17 Jakub Jelinek <jakub@redhat.com>
* search.c (lookup_conversions_r): Fix a pasto.
* g++.dg/parse/lookup5.C: New test.
--- gcc/cp/search.c.jj 2005-10-28 22:59:33.000000000 +0200
+++ gcc/cp/search.c 2006-01-17 16:34:38.000000000 +0100
@@ -2355,7 +2355,7 @@ lookup_conversions_r (tree binfo,
{
parent_tpl_convs = tree_cons (binfo, my_tpl_convs, parent_tpl_convs);
if (virtual_depth)
- TREE_STATIC (parent_convs) = 1;
+ TREE_STATIC (parent_tpl_convs) = 1;
}
child_convs = other_convs;
--- gcc/testsuite/g++.dg/parse/lookup5.C.jj 2006-01-17 16:42:26.000000000 +0100
+++ gcc/testsuite/g++.dg/parse/lookup5.C 2006-01-17 16:42:36.000000000 +0100
@@ -0,0 +1,26 @@
+// { dg-do compile }
+
+struct A {};
+
+template <class T> struct B
+{
+ T a, b;
+ B() {}
+ B(T x, T y) : a(x), b(y) {}
+ template <class U> operator B<U> () const
+ { return B<U>((U)(this->a), (U)(this->b)); }
+};
+
+template <class T> struct C : public B<int>
+{
+ T *c;
+ inline T & operator *() { return *c; }
+};
+
+template <class T> struct D : virtual public C<T> { };
+
+void
+foo (D<A> x)
+{
+ *x;
+}
Jakub