[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Sema / c2x-bool.c
blob0bc147228fda4d4f1931f6ec5a3f3b73ab89f2fc
1 // RUN: %clang_cc1 -std=c2x -fsyntax-only -verify %s
3 _Static_assert(_Generic(true, _Bool : 1, default: 0));
4 _Static_assert(_Generic(false, _Bool : 1, default: 0));
6 _Static_assert(_Generic(true, bool : 1, default: 0));
7 _Static_assert(_Generic(false, bool : 1, default: 0));
9 _Static_assert(_Generic(true, bool : true, default: false));
10 _Static_assert(_Generic(false, bool : true, default: false));
12 _Static_assert(true == (bool)+1);
13 _Static_assert(false == (bool)+0);
15 _Static_assert(_Generic(+true, bool : 0, unsigned int : 0, signed int : 1, default : 0));
17 struct S {
18 bool b : 1;
19 } s;
20 _Static_assert(_Generic(+s.b, bool : 0, unsigned int : 0, signed int : 1, default : 0));
22 static void *f = false; // expected-warning {{to null from a constant boolean expression}}
23 static int one = true;
24 static int zero = false;
26 static void do_work() {
27 char *str = "Foo";
28 str[false] = 'f';
29 str[true] = 'f';
31 char c1[true];
32 char c2[false];
35 #if true != 1
36 #error true should be 1 in the preprocessor
37 #endif
39 #if false != 0
40 #error false should be 0 in the preprocessor
41 #endif