[Bug c++/96310] New: Ignoring Wnonnull via pragma gcc diagnostics still produces a unwanted note
romain.geissler at amadeus dot com
gcc-bugzilla@gcc.gnu.org
Fri Jul 24 15:36:18 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96310
Bug ID: 96310
Summary: Ignoring Wnonnull via pragma gcc diagnostics still
produces a unwanted note
Product: gcc
Version: 11.0
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,
When trying to ignore some uses of null object which apparently are done on
purpose in Boost::concept, I noticed that ignoring the Wnonnull warning via
pragmas still produces an unwanted note giving the details of the callstack.
See this (compiled with -Wnonnull):
struct C {
void method() {}
};
void f()
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnonnull"
static_cast<C*>(0)->method();
#pragma GCC diagnostic pop
}
generates the following compiler note output, while we did expect none:
<source>: In function 'void f()':
<source>:2:10: note: in a call to non-static member function 'void C::method()'
2 | void method() {}
| ^~~~~~
Compiler returned: 0
Cheers,
Romain
More information about the Gcc-bugs
mailing list