https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120187
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> --- Oh that's a bit annoying. -Wno-deprecated disabled the warning, but because it's a preprocessor #warning it's not *really* a -Wdeprecated warning, it's a -Wcpp warning that is only given when -Wdeprecated is enabled. So yes, you need to use either -Werror -Wno-deprecated or -Werror -Wno-error=cpp I have a patch to remove the #warning for C++17 which I'll test for both gcc 15.2 and 16.x, but that won't change anything for 15.1.0 now as that was already released.