Debian Codegraph @

clang/test/C/C2y/n3469.c

raw
1 // RUN: %clang_cc1 -fsyntax-only -std=c2y -verify -ffreestanding %s
2
3 /* WG14 N3469: Clang 21
4 * The Big Array Size Survey
5 *
6 * This renames _Lengthof to _Countof and introduces the stdcountof.h header.
7 */
8
9 void test() {
10 (void)_Countof(int[12]); // Ok
11 (void)_Lengthof(int[12]); // expected-error {{use of undeclared identifier '_Lengthof'}} \
12 expected-error {{expected expression}}
13 }
14
15 #ifdef countof
16 #error "why is countof defined as a macro?"
17 #endif
18
19 #include <stdcountof.h>
20
21 #ifndef countof
22 #error "why is countof not defined as a macro?"
23 #endif