]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gdc.test/fail_compilation/failob1.d
d: Import dmd b8384668f, druntime e6caaab9, phobos 5ab9ad256 (v2.098.0-beta.1)
[thirdparty/gcc.git] / gcc / testsuite / gdc.test / fail_compilation / failob1.d
1 /*
2 REQUIRED_ARGS:-preview=dip1021
3 TEST_OUTPUT:
4 ---
5 fail_compilation/failob1.d(104): Error: variable `failob1.test1.a1` is left dangling at return
6 fail_compilation/failob1.d(105): Error: variable `failob1.test2.a2` is left dangling at return
7 fail_compilation/failob1.d(107): Error: variable `failob1.test4.s4` is left dangling at return
8 fail_compilation/failob1.d(108): Error: variable `failob1.test5.dg5` is left dangling at return
9 fail_compilation/failob1.d(115): Error: variable `failob1.test12.p12` is left dangling at return
10 ---
11 */
12
13 struct S { int i; int* f; }
14 struct T { int i; const(int)* f; }
15 class C { int i; int* f; }
16
17 #line 100
18
19 @live
20 {
21 // Test what is and is not a trackable variable
22 void test1(int[] a1) { } // error
23 void test2(int*[3] a2) { } // error
24 void test3(const int*[3] a) { } // ok
25 void test4(S s4) { } // error
26 void test5(int delegate() dg5) { } // error
27 void test6(const(int*)[3] a) { } // ok
28 void test7(const(int)*[3] a) { } // ok
29 void test8(const(int)* p) { } // ok
30 void test9(T t) { } // ok
31 void test10(C c) { } // ok
32 void test11(int i) { } // ok
33 void test12(int* p12) { } // error
34 }