From 81bec060e31b6ef2feeb3046c6f13a207c6f698a Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 7 Jul 2022 10:12:04 -0400 Subject: c++: -Woverloaded-virtual and dtors [PR87729] My earlier patch broke out of the loop over base members when we found a match, but that caused trouble for dtors, which can have multiple for which same_signature_p is true. But as the function comment says, we know this doesn't apply to [cd]tors, so skip them. PR c++/87729 gcc/cp/ChangeLog: * class.cc (warn_hidden): Ignore [cd]tors. gcc/testsuite/ChangeLog: * g++.dg/warn/Woverloaded-virt3.C: New test. --- gcc/cp/class.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gcc/cp/class.cc') diff --git a/gcc/cp/class.cc b/gcc/cp/class.cc index 17683f4..eb69e7f 100644 --- a/gcc/cp/class.cc +++ b/gcc/cp/class.cc @@ -3020,6 +3020,9 @@ warn_hidden (tree t) tree binfo; unsigned j; + if (IDENTIFIER_CDTOR_P (name)) + continue; + /* Iterate through all of the base classes looking for possibly hidden functions. */ for (binfo = TYPE_BINFO (t), j = 0; -- cgit v1.1