[Bug c++/79078] Warnings from deprecated attribute are too noisy
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jul 30 13:49:35 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79078
--- Comment #17 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #16)
> struct string
> {
> #if __cplusplus == 201703L
> [[deprecated("use shrink_to_fit() instead")]]
> #elif __cplusplus > 201703L
> private:
> #endif
> void reserve()
> { }
> public:
The solution here is to just disable the warning around this use:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
> void shrink_to_fit() { reserve(); }
#pragma GCC diagnostic pop
> };
So I don't need a compiler change after all.
More information about the Gcc-bugs
mailing list