1 // RUN: %clang_cc1 -std=c23 -fexperimental-new-constant-interpreter -verify=expected,both %s
2 // RUN: %clang_cc1 -std=c23 -verify=ref,both %s
3 // RUN: %clang_cc1 -std=c23 -triple=aarch64_be-linux-gnu -fexperimental-new-constant-interpreter -verify=expected,both %s
4 // RUN: %clang_cc1 -std=c23 -triple=aarch64_be-linux-gnu -verify=ref,both %s
7 typedef typeof(nullptr) nullptr_t
;
9 const _Bool inf1
= (1.0/0.0 == __builtin_inf());
10 constexpr _Bool inf2
= (1.0/0.0 == __builtin_inf()); // both-error {{must be initialized by a constant expression}} \
11 // both-note {{division by zero}}
12 constexpr _Bool inf3
= __builtin_inf() == __builtin_inf();
21 #define DECL_BUFFER(Ty, Name) alignas(Ty) unsigned char Name[sizeof(Ty)]
24 DECL_BUFFER(struct S
, buffer
);
25 ((struct S
*)buffer
)->c
= 'a';
26 return ((struct S
*)buffer
)->c
;
29 static_assert((nullptr_t
){} == 0);
31 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
33 #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
39 typedef unsigned char u8x4_t
__attribute__((vector_size(4)));
40 constexpr u8x4_t arg1
= (u8x4_t
)0xCAFEBABE; // okay
42 static_assert(arg1
[0] == 190);
43 static_assert(arg1
[1] == 186);
44 static_assert(arg1
[2] == 254);
45 static_assert(arg1
[3] == 202);
47 static_assert(arg1
[0] == 202);
48 static_assert(arg1
[1] == 254);
49 static_assert(arg1
[2] == 186);
50 static_assert(arg1
[3] == 190);