Fix PR c++/70205 (ICE on valid call to qualified static member function)
authorPatrick Palka <ppalka@gcc.gnu.org>
Fri, 18 Mar 2016 01:26:50 +0000 (01:26 +0000)
committerPatrick Palka <ppalka@gcc.gnu.org>
Fri, 18 Mar 2016 01:26:50 +0000 (01:26 +0000)
gcc/cp/ChangeLog:

PR c++/70205
* search.c (adjust_result_of_qualified_name_lookup): Don't
update the BASELINK_BINFO of DECL if the second call
to lookup_base fails.

gcc/testsuite/ChangeLog:

PR c++/70205
* g++.dg/lookup/pr70205.C: New test.

From-SVN: r234317

gcc/cp/ChangeLog
gcc/cp/search.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/lookup/pr70205.C [new file with mode: 0644]

index 764122a30637a26aba8ff29f00da5a4fc1855099..7e3ceeb5d29efdba77eec6b357833d1faac81862 100644 (file)
@@ -1,3 +1,10 @@
+2016-03-18  Patrick Palka  <ppalka@gcc.gnu.org>
+
+       PR c++/70205
+       * search.c (adjust_result_of_qualified_name_lookup): Don't
+       update the BASELINK_BINFO of DECL if the second call
+       to lookup_base fails.
+
 2016-03-18  Patrick Palka  <ppalka@gcc.gnu.org>
 
        PR c++/70218
index 792461189152ad68c40023ae4756d5c3403c7e3a..503e34b7f2e5b8d76682a2550f2736ff2e5e7367 100644 (file)
@@ -1751,9 +1751,11 @@ adjust_result_of_qualified_name_lookup (tree decl,
       if (base && base != error_mark_node)
        {
          BASELINK_ACCESS_BINFO (decl) = base;
-         BASELINK_BINFO (decl)
+         tree decl_binfo
            = lookup_base (base, BINFO_TYPE (BASELINK_BINFO (decl)),
                           ba_unique, NULL, tf_none);
+         if (decl_binfo && decl_binfo != error_mark_node)
+           BASELINK_BINFO (decl) = decl_binfo;
        }
     }
 
index 5f792eee8037e06e48d7028412bc66863cadbf87..b56c9bf7351391be7f8c272abebef9f54218fc28 100644 (file)
@@ -1,3 +1,8 @@
+2016-03-18  Patrick Palka  <ppalka@gcc.gnu.org>
+
+       PR c++/70205
+       * g++.dg/lookup/pr70205.C: New test.
+
 2016-03-18  Patrick Palka  <ppalka@gcc.gnu.org>
 
        PR c++/70218
diff --git a/gcc/testsuite/g++.dg/lookup/pr70205.C b/gcc/testsuite/g++.dg/lookup/pr70205.C
new file mode 100644 (file)
index 0000000..3bda7fb
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/70205
+
+struct A
+{
+protected:
+  static void f ();
+};
+struct B : A { };
+struct C : A { };
+struct D : C, B { void a () { D::f (); } };
+struct E : D { void b () { D::f (); } };