d: Merge upstream dmd, druntime 4c18eed967, phobos d945686a4.
[official-gcc.git] / gcc / testsuite / gdc.test / compilable / warn12809.d
blob7386f1e9e19d54f36b111fc82abb7d276362a649
1 // REQUIRED_ARGS: -o- -w
3 /*
4 Warning removed in: https://github.com/dlang/dmd/pull/15568
5 ---
6 fail_compilation/warn12809.d(25): Warning: statement is not reachable
7 fail_compilation/warn12809.d(33): Warning: statement is not reachable
8 ---
9 */
11 //void test_unrachable1()
12 //{
13 // try assert(0);
14 // finally
15 // {
16 // int x = 1; // unreachable
17 // }
18 //}
20 void test_unrachable2()
22 try assert(0);
23 finally {}
25 int x = 1; // unreachable
28 void test_unrachable3()
30 try {}
31 finally assert(0);
33 int x = 1; // unreachable
36 /********************************************/
40 ---
41 fail_compilation/warn12809.d(108): Warning: statement is not reachable
42 fail_compilation/warn12809.d(115): Warning: statement is not reachable
43 fail_compilation/warn12809.d(122): Warning: statement is not reachable
44 Error: warnings are treated as errors
45 Use -wi if you wish to treat warnings only as informational.
46 ---
49 #line 100
51 alias noreturn = typeof(*null);
53 noreturn foo();
55 void test1(ref int i)
57 foo();
58 i = 3;
61 void test2()
63 try foo();
64 finally { }
65 int x = 1;
68 void test3()
70 try { }
71 finally foo();
72 int x = 1;
75 // https://issues.dlang.org/show_bug.cgi?id=14835
76 bool isEven(int i)()
78 static if (i % 2)
79 return true;
80 return false;
83 enum x = isEven!0;
85 // https://issues.dlang.org/show_bug.cgi?id=10532
86 alias Seq(T...) = T;
87 void f()
89 foreach (e; Seq!(10, 20))
91 if (e == 10)
92 continue;
94 // lots of code follows..
95 auto x = 1;