You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
return4, // expected-error {{expected ';' after return statement}}
79
80
}
81
+
82
+
#if__STDC_VERSION__ >= 202311L
83
+
voidattr_decl_in_selection_statement(intn) {
84
+
if (1)
85
+
[[]]; // expected-warning {{expected a statement before ';' but got an attribute declaration, it is not allowed by the syntax in places where a statement is required}}
86
+
87
+
if (1) {
88
+
89
+
} else
90
+
[[]]; // expected-warning {{expected a statement before ';' but got an attribute declaration, it is not allowed by the syntax in places where a statement is required}}
91
+
92
+
93
+
switch (n)
94
+
[[]]; // expected-warning {{expected a statement before ';' but got an attribute declaration, it is not allowed by the syntax in places where a statement is required}}
95
+
}
96
+
97
+
voidattr_decl_in_iteration_statement(intn) {
98
+
inti;
99
+
for (i=0; i<n; ++i)
100
+
[[]]; // expected-warning {{expected a statement before ';' but got an attribute declaration, it is not allowed by the syntax in places where a statement is required}}
101
+
102
+
while (i>0)
103
+
[[]]; // expected-warning {{expected a statement before ';' but got an attribute declaration, it is not allowed by the syntax in places where a statement is required}}
104
+
105
+
do
106
+
[[]]; // expected-warning {{expected a statement before ';' but got an attribute declaration, it is not allowed by the syntax in places where a statement is required}}
Copy file name to clipboardExpand all lines: clang/test/Sema/c2x-fallthrough.c
+10-5Lines changed: 10 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -16,17 +16,22 @@ void f(int n) {
16
16
}
17
17
case2:
18
18
for (intn=0; n!=10; ++n)
19
-
[[fallthrough]]; // expected-error {{does not directly precede switch label}}
19
+
[[fallthrough]]; // expected-error {{does not directly precede switch label}} \
20
+
// expected-warning {{expected a statement before ';' but got an attribute declaration, it is not allowed by the syntax in places where a statement is required}}
20
21
case3:
21
22
while (1)
22
-
[[fallthrough]]; // expected-error {{does not directly precede switch label}}
23
+
[[fallthrough]]; // expected-error {{does not directly precede switch label}} \
24
+
// expected-warning {{expected a statement before ';' but got an attribute declaration, it is not allowed by the syntax in places where a statement is required}}
23
25
case4:
24
26
while (0)
25
-
[[fallthrough]]; // expected-error {{does not directly precede switch label}}
27
+
[[fallthrough]]; // expected-error {{does not directly precede switch label}} \
28
+
// expected-warning {{expected a statement before ';' but got an attribute declaration, it is not allowed by the syntax in places where a statement is required}}
26
29
case5:
27
-
do [[fallthrough]]; while (1); // expected-error {{does not directly precede switch label}}
30
+
do [[fallthrough]]; while (1); // expected-error {{does not directly precede switch label}} \
31
+
// expected-warning {{expected a statement before ';' but got an attribute declaration, it is not allowed by the syntax in places where a statement is required}}
28
32
case6:
29
-
do [[fallthrough]]; while (0); // expected-error {{does not directly precede switch label}}
33
+
do [[fallthrough]]; while (0); // expected-error {{does not directly precede switch label}} \
34
+
// expected-warning {{expected a statement before ';' but got an attribute declaration, it is not allowed by the syntax in places where a statement is required}}
0 commit comments