diff --git a/clang/test/C/C2x/n2838.c b/clang/test/C/C2x/n2838.c new file mode 100644 index 0000000000000..f110fef9d0f41 --- /dev/null +++ b/clang/test/C/C2x/n2838.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -verify -std=c2x %s + +/* WG14 N2838: yes + * Types and sizes + */ + +char buffer4[0xFFFF'FFFF'FFFF'FFFF'1wb]; /* expected-error {{array is too large (295147905179352825841 elements)}} */ +char buffer3[0xFFFF'FFFF'FFFF'FFFFwb]; /* expected-error {{array is too large (18446744073709551615 elements)}} */ +char buffer2[0x7FFF'FFFF'FFFF'FFFFwb]; /* expected-error {{array is too large (9223372036854775807 elements)}} */ +char buffer1[0x1FFF'FFFF'FFFF'FFFFwb]; /* array is juuuuuust right */ + +/* The largest object we can create is still smaller than SIZE_MAX. */ +static_assert(0x1FFF'FFFF'FFFF'FFFFwb <= __SIZE_MAX__); diff --git a/clang/www/c_status.html b/clang/www/c_status.html index dcc02e8b05145..20eec37fce3de 100644 --- a/clang/www/c_status.html +++ b/clang/www/c_status.html @@ -972,7 +972,7 @@

C2x implementation status

Types and sizes N2838 - Unknown + Yes Clarifying integer terms