[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Parser / ms-if-exists.c
blob66b85424757e377a6e75a0b4b4ed4408e229736f
1 // RUN: %clang_cc1 %s -fsyntax-only -Wmicrosoft -verify -fms-extensions
2 // expected-no-diagnostics
4 struct Type {
5 };
7 void test_if_exists_stmts(void) {
8 int b = 0;
9 __if_exists(Type) {
10 b++;
11 b++;
13 __if_exists(Type_not) {
14 this will not compile.
16 __if_not_exists(Type) {
17 this will not compile.
19 __if_not_exists(Type_not) {
20 b++;
21 b++;
25 int if_exists_creates_no_scope(void) {
26 __if_exists(Type) {
27 int x; // 'x' is declared in the parent scope.
29 __if_not_exists(Type_not) {
30 x++;
32 return x;
35 __if_exists(Type) {
36 int var23;
39 __if_exists(Type_not) {
40 this will not compile.
43 __if_not_exists(Type) {
44 this will not compile.
47 __if_not_exists(Type_not) {
48 int var244;
51 void test_if_exists_init_list(void) {
53 int array1[] = {
55 __if_exists(Type) {2, }
59 int array2[] = {
61 __if_exists(Type_not) { this will not compile }
65 int array3[] = {
67 __if_not_exists(Type_not) {2, }
71 int array4[] = {
73 __if_not_exists(Type) { this will not compile }
80 void test_nested_if_exists(void) {
81 __if_exists(Type) {
82 int x = 42;
83 __if_not_exists(Type_not) {
84 x++;