File tree Expand file tree Collapse file tree 1 file changed +65
-0
lines changed Expand file tree Collapse file tree 1 file changed +65
-0
lines changed Original file line number Diff line number Diff line change 1+ // @warnings{no-unused}
2+ // @warnings{unreachable-code}
3+
4+ module test;
5+
6+ fn i32 test1(i32 n) {
7+ switch (n) {
8+ case 1:
9+ return 1;
10+ default:
11+ return 0;
12+ }
13+ return 2; // @warning{unreachable code}
14+ }
15+
16+ fn i32 test3(i32 n) {
17+ while (true) {
18+ return 1;
19+ }
20+ return 2; // @warning{unreachable code}
21+ }
22+
23+ fn i32 test4(i32 n) {
24+ for (;;) {
25+ return 1;
26+ }
27+ return 2; // @warning{unreachable code}
28+ }
29+
30+ fn i32 test5(i32 n) {
31+ while (true) {
32+ }
33+ return 2; // @warning{unreachable code}
34+ }
35+
36+ fn i32 test6(i32 n) {
37+ for (;;) {
38+ }
39+ return 2; // @warning{unreachable code}
40+ }
41+
42+ fn i32 test7(i32 n) {
43+ for (;;) {
44+ switch (n) {
45+ case 1:
46+ continue;
47+ default:
48+ return 0;
49+ }
50+ return 2; // @warning{unreachable code}
51+ }
52+ return 3; // @warning{unreachable code}
53+ }
54+
55+ fn i32 test8(i32 n) {
56+ for (;;) {
57+ switch (n) {
58+ case 1:
59+ return 1;
60+ default:
61+ return 0;
62+ }
63+ }
64+ return 2; // @warning{unreachable code}
65+ }
You can’t perform that action at this time.
0 commit comments