It is not supported in <= C23 mode. gcc/c/ChangeLog:
* c-parser.cc (c_parser_sizeof_or_countof_expression): Add -Wpedantic diagnostic for _Countof in <= C23 mode. Signed-off-by: Alejandro Colomar <a...@kernel.org> --- gcc/c/c-parser.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc index 87700339394..d2193ad2f34 100644 --- a/gcc/c/c-parser.cc +++ b/gcc/c/c-parser.cc @@ -10637,6 +10637,10 @@ c_parser_sizeof_or_countof_expression (c_parser *parser, enum rid rid) start = c_parser_peek_token (parser)->location; + if (rid == RID_COUNTOF) + pedwarn_c23 (start, OPT_Wpedantic, + "ISO C does not support %qs before C23", op_name); + c_parser_consume_token (parser); c_inhibit_evaluation_warnings++; if (rid == RID_COUNTOF) -- 2.49.0