https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86301
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> --- The link I gave explains that such code is ill-formed, no diagnostic required. See https://en.cppreference.com/w/cpp/language/ub for an explanation. That means the compiler is not required to give an error. So it is not a bug in GCC and not a bug in Clang.