On Tue, 5 Oct 2021, Jakub Jelinek via Gcc-patches wrote: > One is in the patch below, ignores that sentence and only implements it > for -std=c++23/-std=gnu++23 like it is only implemented for -std=c23. > Another option would be to implement it also in the older GNU modes but > not in the C/CXX modes (but it would be strange if we did that just for > C++ and not for C). > Yet another option is to enable it unconditionally. > And yet another option would be to enable it unconditionally but emit > a warning (or pedwarn) when it is seen. > Note, when it is enabled for the older language modes, as Joseph wrote > in the c11-elifdef-1.c testcase, it can result e.g. in rejecting previously > valid code:
It would probably be reasonable to enable it in older GNU modes for C as well as C++ if desired (and, in that case, emit a pedwarn-if-pedantic when it's acted on) - cases where it affects compatibility should be rare. Enabling with a pedwarn in strict modes is problematic because it changes semantics of valid code where it was inside #if 0, however. It doesn't make sense at all to me to think of a new feature like this (one with no prior art in C mentioned in the WG14 proposal) as a defect fix. Any normal directive - i.e. one that has no effect on the preprocessor #if structure and so is ignored inside #if 0 for all language versions - can more reasonably be enabled for all language versions with a pedwarn when used for old versions. (In particular, that will be appropriate for #warning, where the "don't pedwarn in C2X modes" part needs implementing after N2686 was accepted at the August / September WG14 meeting - I don't know if C++ is doing anything with #warning.) -- Joseph S. Myers jos...@codesourcery.com