[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Headers / c11.c
blobb5896316a82d5d4b76ade94cb9c6bb71c7d50144
1 // RUN: rm -rf %t
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c11 %s
3 // RUN: %clang_cc1 -fsyntax-only -verify -std=c11 -fmodules -fmodules-cache-path=%t %s -D__STDC_WANT_LIB_EXT1__=1
4 // RUN: %clang_cc1 -fsyntax-only -verify -std=c11 -ffreestanding %s
5 // RUN: %clang_cc1 -fsyntax-only -verify -std=c11 -triple i686-pc-win32 -fms-compatibility-version=17.00 %s
7 noreturn int f(void); // expected-error 1+{{}}
9 #include <stdnoreturn.h>
10 #include <stdnoreturn.h>
11 #include <stdnoreturn.h>
13 int g(void);
14 noreturn int g(void);
15 int noreturn g(void);
16 int g(void);
18 #include <stdalign.h>
19 _Static_assert(__alignas_is_defined, "");
20 _Static_assert(__alignof_is_defined, "");
21 alignas(alignof(int)) char c[4];
22 _Static_assert(__alignof(c) == 4, "");
24 #define __STDC_WANT_LIB_EXT1__ 1
25 #include <stddef.h>
26 rsize_t x = 0;
27 _Static_assert(sizeof(max_align_t) >= sizeof(long long), "");
28 _Static_assert(alignof(max_align_t) >= alignof(long long), "");
29 _Static_assert(sizeof(max_align_t) >= sizeof(long double), "");
30 _Static_assert(alignof(max_align_t) >= alignof(long double), "");
32 #ifdef _MSC_VER
33 _Static_assert(sizeof(max_align_t) == sizeof(double), "");
34 #endif
36 // If we are freestanding, then also check RSIZE_MAX (in a hosted implementation
37 // we will use the host stdint.h, which may not yet have C11 support).
38 #ifndef __STDC_HOSTED__
39 #include <stdint.h>
40 rsize_t x2 = RSIZE_MAX;
41 #endif