Debian Codegraph @

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

raw
1 /*
2 REQUIRED_ARGS: -de
3 TEST_OUTPUT:
4 ---
5 fail_compilation/systemvariables_deprecation.d(15): Deprecation: `@safe` function `main` calling `middle`
6 fail_compilation/systemvariables_deprecation.d(20): which calls `inferred`
7 fail_compilation/systemvariables_deprecation.d(26): and access `@system` variable `x0` makes it fail to infer `@safe`
8 ---
9 */
10
11 // test deprecation messages before -preview=systemVariables becomes default
12
13 void main() @safe
14 {
15 middle(); // nested deprecation
16 }
17
18 auto middle()
19 {
20 return inferred(); // no deprecation, inferredC is not explicit `@safe`
21 }
22
23 auto inferred()
24 {
25 @system int* x0;
26 x0 = null;
27 }