This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C++ PATCH] Fix lookup_conversions_r (4.0/4.1/4.2 regression)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]