https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90884
Bug ID: 90884
Summary: Option `-Wctor-dtor-privacy' enables warning even for
system headers
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: cspiel at freenet dot de
Target Milestone: ---
Using g++, which is
g++-10.0.0 (GCC) 10.0.0 20190612 (experimental)
as
g++-10.0.0 -Wctor-dtor-privacy -c g++-10-privacy-warning.cc
on the two-liner file "g++-10-privacy-warning.cc"
#include <type_traits>
bool foo() {return std::is_integral<int>::value;}
I get the following note:
/usr/local/include/c++/10.0.0/type_traits:2900:5: note:
'std::__nonesuch::__nonesuch(const std::__nonesuch&)' is public, but requires
an existing 'struct std::__nonesuch' object
2900 | __nonesuch(__nonesuch const&) = delete;
| ^~~~~~~~~~
The note is deserved, but IMHO should be suppressed for headers in
system directories despite being explicitly enabled at the command
line with `-Wctor-dtor-privacy'.
g++-6.3.0 does not issue a note/warning as expected.
BTW, the note presists even if I play hardball:
g++-10.0.0 \
-Wctor-dtor-privacy \
-nostdinc++ \
-isystem /usr/local/include/c++/10.0.0/x86_64-pc-linux-gnu \
-isystem /usr/local/include/c++/10.0.0 \
-c \
g++-10-privacy-warning.cc
This issue may be related to Bug 71484, comment 2.