From 91914f0adb0b128c74773872a478c3d4da143ab8 Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Fri, 18 Mar 2016 01:26:50 +0000 Subject: [PATCH] Fix PR c++/70205 (ICE on valid call to qualified static member function) 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 | 7 +++++++ gcc/cp/search.c | 4 +++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/lookup/pr70205.C | 11 +++++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/lookup/pr70205.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 764122a3063..7e3ceeb5d29 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2016-03-18 Patrick Palka + + 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 PR c++/70218 diff --git a/gcc/cp/search.c b/gcc/cp/search.c index 79246118915..503e34b7f2e 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -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; } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5f792eee803..b56c9bf7351 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-03-18 Patrick Palka + + PR c++/70205 + * g++.dg/lookup/pr70205.C: New test. + 2016-03-18 Patrick Palka 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 index 00000000000..3bda7fb35ce --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/pr70205.C @@ -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 (); } }; -- 2.30.2