c++: -Wdeprecated-copy and #pragma diagnostic [PR94492]
-Wdeprecated-copy was depending only on the state of the warning at the
point where we call the function, making it hard to use #pragma diagnostic
to suppress the warning for a particular implicitly declared function.
But checking whether the warning is enabled at the location of the implicit
declaration turned out to be a bit complicated; option_enabled only tests
whether it was enabled at the start of compilation, the actual test only
existed in the middle of diagnostic_report_diagnostic. So this patch
factors it out and adds a new warning_enabled function to diagnostic.h.
gcc/ChangeLog:
PR c++/94492
* diagnostic.h (warning_enabled_at): Declare.
* diagnostic.c (diagnostic_enabled): Factor out from...
(diagnostic_report_diagnostic): ...here.
(warning_enabled_at): New.
gcc/cp/ChangeLog:
PR c++/94492
* decl2.c (cp_warn_deprecated_use): Check warning_enabled_at.
gcc/testsuite/ChangeLog:
PR c++/94492
* g++.dg/cpp0x/depr-copy4.C: New test.