Debian Codegraph @

gcc/testsuite/gdc.test/fail_compilation/ctfeblock.d

raw
1 /* TEST_OUTPUT:
2 ---
3 fail_compilation/ctfeblock.d(112): Error: cannot `goto` into `if (__ctfe)` block
4 ---
5 */
6
7 /*******************************************/
8 // https://issues.dlang.org/show_bug.cgi?id=18472
9 // https://github.com/dlang/dmd/pull/14676
10
11 #line 100
12
13 struct T { }
14
15 @nogc void test1()
16 {
17 int a;
18 if (__ctfe)
19 {
20 L1:
21 new T();
22 a = 3;
23 }
24 goto L1;
25 }
26
27 @nogc void test2()
28 {
29 if (__ctfe)
30 {
31 new T();
32 }
33 }
34
35 @nogc void test3()
36 {
37 if (!__ctfe)
38 {
39 }
40 else
41 {
42 int* p = new int;
43 }
44 }