brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 0c07c9a Raw
35 lines · c
1// RUN: %clang_cc1 -ffreestanding -verify=c23 -std=c23 %s2// RUN: %clang_cc1 -ffreestanding -verify=c17 -std=c17 %s3 4// c23-no-diagnostics5 6#include <stdatomic.h>7 8#define __enable_constant_folding(x) (__builtin_constant_p(x) ? (x) : (x))9#define __is_same(a, b) (__extension__ _Generic(a, b: 1, default: 0) && __extension__ _Generic(b, a: 1, default: 0))10 11#ifndef ATOMIC_CHAR8_T_LOCK_FREE12#error missing13#endif14// c17-error@-2 {{missing}}15 16_Static_assert(__is_same(atomic_char8_t, unsigned char _Atomic), "");17// c17-error@-1 {{use of undeclared identifier 'atomic_char8_t'}}18// c17-error@-2 {{unknown type name 'atomic_char8_t'}}19 20_Static_assert(_Generic(u8"", unsigned char*: 1, char*: 0), "");21// c17-error@-1 {{static assertion failed}}22 23// -fsigned-char is the default24#define M(X) __enable_constant_folding((X) >= 0x80)25 26_Static_assert(M(u8"\U000000E9"[0]), "");27// c17-error@-1 {{static assertion failed}}28#if __STDC_VERSION__ >= 202311L29_Static_assert(M(u8'\xC3'), "");30#endif31 32const          char cu8[]  = u8"text";33const signed   char scu8[] = u8"text";34const unsigned char ucu8[] = u8"text";35