https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119754
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- GCC fails to diagnose it for the same reason that it fails to diagnose this: #include <memory> consteval bool f() { int* p = std::allocator<int>().allocate(1); *p = 99; std::allocator<int>().deallocate(p, 1); return true; } static_assert(f()); I'm not sure if we have a bug about this, but there are some similar ones.