On Wed, May 10, 2023 at 06:30:40PM +0300, Eli Zaretskii wrote: > > Date: Wed, 10 May 2023 16:22:26 +0200 > > From: Jakub Jelinek <ja...@redhat.com> > > Cc: Gabriel Ravier <gabrav...@gmail.com>, jwakely....@gmail.com, > > fwei...@redhat.com, gcc@gcc.gnu.org, ar...@aarsen.me > > > > > > Are you seriously saying that no accepts-invalid bug should ever be > > > > fixed under any circumstances on the basis that some programmers might > > > > rely on code exploiting that bug ?? > > > > > > Sorry, I'm afraid I don't understand the question. What are > > > "accepts-invalid bugs"? > > > > They are bugs where compiler accepts something that isn't valid in > > the selected language nor considered valid extension. > > So, after the fix we reject something that has been accepted before. > > If some program is plainly invalid, not just because the criteria of > validity have shifted, then yes, such a program should be rejected.
Many of the accepts-invalid cases are when something used to be valid in some older standard and is not valid in a newer standard, often even changes meaning completely in even newer standard. Examples include e.g. the auto keyword, which means something completely different in C++11 and later than what it meant in C++98, or say comma in array reference in C++17 vs. C++20 vs. C++23 (a[1, 2] is the same as a[(1, 2)] in C++17, got deprecated in C++20 and is ill-formed or changed meaning in C++23 (multi-dimensional array operator). Or any time something that wasn't a keyword in older standard version and is a keyword in a newer standard. alignas/alignof/nullptr/static_assert/thread_local in C++11 and C23, char16_t/char32_t/constexpr/decltype/noexcept in C++11, constinit/consteval in C++20, bool/false/true/typeof_unqual in C23. int bool = 1; is completely valid C17 if one doesn't include <stdbool.h> header, or int static_assert = 2; valid C17 if one doesn't include <assert.h> etc. These used to compile and will no any longer wheen using -std=c2x or in a few years when -std=gnu23 becomes the default will not compile by default, even when it used to be valid C17. And here are talking about code that wasn't valid already in C99... Jakub