https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120915
--- Comment #3 from Cristian Morales Vega <christian.morales.vega at gmail dot com> --- > But isn't it valid (seems like a common idiom in C++)? I'm not a qualified language lawyer. But looking at https://www.open-std.org/JTC1/SC22/WG21/docs/papers/2020/n4861.pdf, in "7.6.9 Relational operators". It says "The result of comparing unequal pointers to objects (77)", and footnote 77 says "a pointer past the last element of an array of n elements is considered to be equivalent to a pointer to a hypothetical array element n for this purpose."