https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105695
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2022-05-23 Keywords| |build Ever confirmed|0 |1 --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- Indeed. #include <utility> void foo (void *a, void *b) { std::swap (a, b); } > ~/install/gcc-12/usr/local/bin/g++ t.C -S -std=gnu++03 t.C: In function 'void foo(void*, void*)': t.C:5:8: error: 'swap' is not a member of 'std' 5 | std::swap (a, b); | ^~~~ works with GCC 11. <algorithm> is required pre C++11 for std::swap. We have #ifdef __cplusplus #if defined (INCLUDE_ALGORITHM) || !defined (HAVE_SWAP_IN_UTILITY) # include <algorithm> #endif but config.h was likely generated with the default C++ standard and not with explicit -std=gnu++98.