| 1 |
/* |
| 2 |
REQUIRED_ARGS:-preview=dip1021 |
| 3 |
TEST_OUTPUT: |
| 4 |
--- |
| 5 |
fail_compilation/failob1.d(104): Error: variable `failob1.test1.a1` is not disposed of before return |
| 6 |
fail_compilation/failob1.d(105): Error: variable `failob1.test2.a2` is not disposed of before return |
| 7 |
fail_compilation/failob1.d(107): Error: variable `failob1.test4.s4` is not disposed of before return |
| 8 |
fail_compilation/failob1.d(108): Error: variable `failob1.test5.dg5` is not disposed of before return |
| 9 |
fail_compilation/failob1.d(115): Error: variable `failob1.test12.p12` is not disposed of before 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 |
} |