public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/109918] New: Unexpected -Woverloaded-virtual with virtual conversion operators @ 2023-05-20 18:28 romain.geissler at amadeus dot com 2023-05-20 18:41 ` [Bug c++/109918] [10/11/12/13/14 Regression] " pinskia at gcc dot gnu.org ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: romain.geissler at amadeus dot com @ 2023-05-20 18:28 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109918 Bug ID: 109918 Summary: Unexpected -Woverloaded-virtual with virtual conversion operators Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: romain.geissler at amadeus dot com Target Milestone: --- Hi, Now that the -Woverloaded-virtual=1 is enabled by default with -Wall, the following code raises warning while I think it should not (for the specific case of conversion operators): #include <iostream> struct A { virtual operator int() { return 42; } virtual operator char() = 0; }; struct B : public A { operator char() override { return 'A'; } }; int main() { B b; std::cout << static_cast<int>(b) << std::endl; // int conversion was not hiden, contrary to what -Woverloaded-virtual claims std::cout << static_cast<char>(b) << std::endl; } Godbolt link: https://godbolt.org/z/4Wb9rxbMP Compiled with -Wall, it raises this warning: <source>:5:13: warning: 'virtual A::operator int()' was hidden [-Woverloaded-virtual=] 5 | virtual operator int() { return 42; } | ^~~~~~~~ <built-in>: note: by 'operator' ASM generation compiler returned: 0 <source>:5:13: warning: 'virtual A::operator int()' was hidden [-Woverloaded-virtual=] 5 | virtual operator int() { return 42; } | ^~~~~~~~ <built-in>: note: by 'operator' Execution build compiler returned: 0 Program returned: 0 42 A I have hit this issue in a real code base, while migrating to gcc 13. Cheers, Romain ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/109918] [10/11/12/13/14 Regression] Unexpected -Woverloaded-virtual with virtual conversion operators 2023-05-20 18:28 [Bug c++/109918] New: Unexpected -Woverloaded-virtual with virtual conversion operators romain.geissler at amadeus dot com @ 2023-05-20 18:41 ` pinskia at gcc dot gnu.org 2023-07-07 10:45 ` [Bug c++/109918] [11/12/13/14 " rguenth at gcc dot gnu.org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu.org @ 2023-05-20 18:41 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109918 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |needs-bisection Summary|Unexpected |[10/11/12/13/14 Regression] |-Woverloaded-virtual with |Unexpected |virtual conversion |-Woverloaded-virtual with |operators |virtual conversion | |operators Known to work| |7.1.0, 7.5.0 Known to fail| |8.1.0 Last reconfirmed| |2023-05-20 Target Milestone|--- |10.5 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Confirmed. GCC 7.5 didn't warn with -Woverloaded-virtual but GCC 8 does. Maybe introduced by r8-2977-g940ab2e08e2414 . ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/109918] [11/12/13/14 Regression] Unexpected -Woverloaded-virtual with virtual conversion operators 2023-05-20 18:28 [Bug c++/109918] New: Unexpected -Woverloaded-virtual with virtual conversion operators romain.geissler at amadeus dot com 2023-05-20 18:41 ` [Bug c++/109918] [10/11/12/13/14 Regression] " pinskia at gcc dot gnu.org @ 2023-07-07 10:45 ` rguenth at gcc dot gnu.org 2024-01-10 17:17 ` jamborm at gcc dot gnu.org 2024-03-08 15:36 ` law at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: rguenth at gcc dot gnu.org @ 2023-07-07 10:45 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109918 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|10.5 |11.5 --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- GCC 10 branch is being closed. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/109918] [11/12/13/14 Regression] Unexpected -Woverloaded-virtual with virtual conversion operators 2023-05-20 18:28 [Bug c++/109918] New: Unexpected -Woverloaded-virtual with virtual conversion operators romain.geissler at amadeus dot com 2023-05-20 18:41 ` [Bug c++/109918] [10/11/12/13/14 Regression] " pinskia at gcc dot gnu.org 2023-07-07 10:45 ` [Bug c++/109918] [11/12/13/14 " rguenth at gcc dot gnu.org @ 2024-01-10 17:17 ` jamborm at gcc dot gnu.org 2024-03-08 15:36 ` law at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: jamborm at gcc dot gnu.org @ 2024-01-10 17:17 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109918 Martin Jambor <jamborm at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|needs-bisection | CC| |nathan at gcc dot gnu.org --- Comment #3 from Martin Jambor <jamborm at gcc dot gnu.org> --- The testcase with -Werror=overloaded-virtual started failing with commit r8-2669-gbff8b385e997a8 (Nathan Sidwell: Conversion operators have a special name). ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/109918] [11/12/13/14 Regression] Unexpected -Woverloaded-virtual with virtual conversion operators 2023-05-20 18:28 [Bug c++/109918] New: Unexpected -Woverloaded-virtual with virtual conversion operators romain.geissler at amadeus dot com ` (2 preceding siblings ...) 2024-01-10 17:17 ` jamborm at gcc dot gnu.org @ 2024-03-08 15:36 ` law at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: law at gcc dot gnu.org @ 2024-03-08 15:36 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109918 Jeffrey A. Law <law at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P3 |P2 CC| |law at gcc dot gnu.org ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-03-08 15:36 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-05-20 18:28 [Bug c++/109918] New: Unexpected -Woverloaded-virtual with virtual conversion operators romain.geissler at amadeus dot com 2023-05-20 18:41 ` [Bug c++/109918] [10/11/12/13/14 Regression] " pinskia at gcc dot gnu.org 2023-07-07 10:45 ` [Bug c++/109918] [11/12/13/14 " rguenth at gcc dot gnu.org 2024-01-10 17:17 ` jamborm at gcc dot gnu.org 2024-03-08 15:36 ` law at gcc dot gnu.org
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).