public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-1559] c++: -Woverloaded-virtual and dtors [PR87729]
@ 2022-07-07 16:00 Jason Merrill
0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2022-07-07 16:00 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:81bec060e31b6ef2feeb3046c6f13a207c6f698a
commit r13-1559-g81bec060e31b6ef2feeb3046c6f13a207c6f698a
Author: Jason Merrill <jason@redhat.com>
Date: Thu Jul 7 10:12:04 2022 -0400
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.
Diff:
---
gcc/cp/class.cc | 3 +++
gcc/testsuite/g++.dg/warn/Woverloaded-virt3.C | 7 +++++++
2 files changed, 10 insertions(+)
diff --git a/gcc/cp/class.cc b/gcc/cp/class.cc
index 17683f421a7..eb69e7f985c 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;
diff --git a/gcc/testsuite/g++.dg/warn/Woverloaded-virt3.C b/gcc/testsuite/g++.dg/warn/Woverloaded-virt3.C
new file mode 100644
index 00000000000..34214ba2557
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Woverloaded-virt3.C
@@ -0,0 +1,7 @@
+// PR c++/87729
+// { dg-additional-options -Woverloaded-virtual }
+
+struct S1 {};
+struct S2: S1 { virtual ~S2(); };
+struct S3 { virtual ~S3(); };
+struct S4: S2, S3 { virtual ~S4(); };
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-07-07 16:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-07 16:00 [gcc r13-1559] c++: -Woverloaded-virtual and dtors [PR87729] Jason Merrill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).