gcc/testsuite/gdc.test/fail_compilation/test12822.d
raw| 1 | /* |
| 2 | TEST_OUTPUT: |
| 3 | --- |
| 4 | fail_compilation/test12822.d(13): Error: modifying delegate pointer `dg.ptr` is not allowed in a `@safe` function |
| 5 | fail_compilation/test12822.d(14): Error: using `dg.funcptr` is not allowed in a `@safe` function |
| 6 | --- |
| 7 | */ |
| 8 | |
| 9 | // https://issues.dlang.org/show_bug.cgi?id=12822 |
| 10 | void test2(int delegate() dg) @safe |
| 11 | { |
| 12 | static int i; |
| 13 | dg.ptr = &i; |
| 14 | dg.funcptr = &func; |
| 15 | } |
| 16 | |
| 17 | int func(); |