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.