https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118392
Bug ID: 118392
Summary: "-w" fails to fully inhibit "'void a::b()' has not
been declared within a" warning
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: connor24nolan at live dot com
Target Milestone: ---
### Expected Behavior
"-w" should hide all warning messages.
### Actual Behavior
"-w" only partially hides the "'void a::b()' has not been declared within a"
message.
Without the flag, it prints:
> <source>:6:6: warning: 'void xxx::bar()' has not been declared within xxx
> void xxx::bar() {}
> ^~~
> <source>:3:20: note: only here as a friend
> friend void bar();
> ^~~
However, with the flag it only prints:
> <source>:3:20: note: only here as a friend
> friend void bar();
> ^~~
This is extremely confusing to see, especially when building third-party code
(one use of the "-w" flag).
### Steps To Reproduce
An example is available at https://godbolt.org/z/Yv699n49v. The bug reproduces
on almost every GCC version I tested. The only exceptions were old versions
that failed to compile the example at all.