[Bug c++/93728] New: First half of warning message suppressed because code pointed to is in system header
loximann at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Feb 13 09:02:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93728
Bug ID: 93728
Summary: First half of warning message suppressed because code
pointed to is in system header
Product: gcc
Version: 9.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: loximann at gmail dot com
Target Milestone: ---
Created attachment 47833
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47833&action=edit
Minimal reproducible example
-Woverloaded-virtual shows only the second half of a warning, making it
confusing, when several circumstances happen:
- A class with two virtual methods with the same name and different signature
exists in a system header.
- Another class inheriting from the previous class does not override any
methods.
- Another class inheriting from the previous class overrides only one method.
The output is this:
$ make
g++ -isystem include -Woverloaded-virtual Woverloaded-virtual.cpp -c
Woverloaded-virtual.cpp:8:9: warning: by ‘virtual void Bar::f(int)’
[-Woverloaded-virtual]
8 | void f(int) final {};
| ^
Including the header as a regular header shows also the first half.
sergio@bnct1:~/src/playground/Woverloaded-virtual$ make
g++ -Iinclude -Woverloaded-virtual Woverloaded-virtual.cpp -c
In file included from Woverloaded-virtual.cpp:1:
include/Woverloaded-virtual.h:4:16: warning: ‘virtual void Foo::f(int,
int)’ was hidden [-Woverloaded-virtual]
4 | virtual void f(int, int){};
| ^
Woverloaded-virtual.cpp:8:9: warning: by ‘virtual void Bar::f(int)’
[-Woverloaded-virtual]
8 | void f(int) final {};
| ^
Minimal reproducible example also available here:
https://gitlab.com/loximann/woverloaded-virtual
More information about the Gcc-bugs
mailing list