[all-commits] [llvm/llvm-project] 00c43a: [C2y] Implement WG14 N3369 and N3469 (_Countof) (#...
Aaron Ballman via All-commits
all-commits at lists.llvm.org
Thu Mar 27 10:23:38 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 00c43ae23524d72707701620da89ad248393a8e4
https://github.com/llvm/llvm-project/commit/00c43ae23524d72707701620da89ad248393a8e4
Author: Aaron Ballman <aaron at aaronballman.com>
Date: 2025-03-27 (Thu, 27 Mar 2025)
Changed paths:
M clang/docs/LanguageExtensions.rst
M clang/docs/ReleaseNotes.rst
M clang/include/clang/AST/Stmt.h
M clang/include/clang/AST/Type.h
M clang/include/clang/Basic/DiagnosticParseKinds.td
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/include/clang/Basic/Features.def
M clang/include/clang/Basic/TokenKinds.def
M clang/lib/AST/ByteCode/Compiler.cpp
M clang/lib/AST/ExprConstant.cpp
M clang/lib/AST/ItaniumMangle.cpp
M clang/lib/CodeGen/CGExprScalar.cpp
M clang/lib/Parse/ParseExpr.cpp
M clang/lib/Sema/SemaExpr.cpp
A clang/test/C/C2y/n3369.c
A clang/test/C/C2y/n3369_1.c
A clang/test/C/C2y/n3369_2.c
A clang/test/C/C2y/n3469.c
M clang/www/c_status.html
Log Message:
-----------
[C2y] Implement WG14 N3369 and N3469 (_Countof) (#133125)
C2y adds the `_Countof` operator which returns the number of elements in
an array. As with `sizeof`, `_Countof` either accepts a parenthesized
type name or an expression. Its operand must be (of) an array type. When
passed a constant-size array operand, the operator is a constant
expression which is valid for use as an integer constant expression.
This is being exposed as an extension in earlier C language modes, but
not in C++. C++ already has `std::extent` and `std::size` to cover these
needs, so the operator doesn't seem to get the user enough benefit to
warrant carrying this as an extension.
Fixes #102836
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list