Author: Aaron Ballman Date: 2026-10-23T15:01:57Z New Revision: a8285b9a9c93d2a71affb8ce782d390e70c3e3e2
URL: https://github.com/llvm/llvm-project/commit/a8285b9a9c93d2a71affb8ce782d390e70c3e3e2 DIFF: https://github.com/llvm/llvm-project/commit/a8285b9a9c93d2a71affb8ce782d390e70c3e3e2.diff LOG: [clang][C2y] Claim lack of support for WG14 N3787 (#234954) We don't yet implement the semantics behind the paper, so we still treat some constructs as being a non-integer constant expression despite use of constexpr objects. Added: clang/test/C/C2y/n3787.c Modified: clang/www/c_status.html Removed: ################################################################################ diff --git a/clang/test/C/C2y/n3787.c b/clang/test/C/C2y/n3787.c new file mode 100644 index 00000000000000..37c0b516c477e0 --- /dev/null +++ b/clang/test/C/C2y/n3787.c @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -verify -std=c2y -Wall -pedantic -Wvla -Wno-unused %s + +/* WG14 N3787: No + * Array constant expressions + * + * FIXME: Clang doesn't yet implement this paper. + */ + +constexpr int p[3] = { 2, 3, 5 }; + +void test() { + // FIXME: This should not be a VLA, p[0] is a valid integer constant + // expression. + float y[p[0]]; // expected-warning {{variable length array used}} + + // Is a VLA, p[3] is not a valid constant expression because of the out-of- + // bounds read. + float z[p[3]]; // expected-warning {{variable length array used}} +} + diff --git a/clang/www/c_status.html b/clang/www/c_status.html index ff9031709e308b..82898f77611278 100644 --- a/clang/www/c_status.html +++ b/clang/www/c_status.html @@ -432,7 +432,7 @@ <h2 id="c2y">C2y implementation status</h2> <tr> <td>Array Constant Expressions</td> <td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3787.pdf">N3787</a></td> - <td class="unknown" align="center">Unknown</td> + <td class="none" align="center">No</td> </tr> <tr> <td>Standard pragmas and headers</td> _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
