https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95797
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Known to work|11.0 | --- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Clang has specific code to catch this: <source>:4:5: error: static_assert expression is not an integral constant expression (std::allocator<int>{}.deallocate(new int, 1), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /opt/compiler-explorer/clang-trunk-20210828/bin/../include/c++/v1/__memory/allocator.h:112:13: note: 'std::allocator<...>::deallocate' used to delete pointer to object allocated with 'new' ::operator delete(__p); ^ <source>:4:28: note: in call to '&std::allocator<int>{}->deallocate(&{*new int#0}, 1)' (std::allocator<int>{}.deallocate(new int, 1), ^ <source>:4:39: note: heap allocation performed here (std::allocator<int>{}.deallocate(new int, 1), ^