Debian Codegraph @

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

raw
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/fail9891.d(13): Error: expression `i` of type `immutable(int)` is not implicitly convertible to type `ref int` of parameter `n`
5 fail_compilation/fail9891.d(18): Error: expression `i` of type `immutable(int)` is not implicitly convertible to type `out int` of parameter `n`
6 fail_compilation/fail9891.d(23): Error: cannot create default argument for `ref` / `out` parameter from expression `prop()` because it is not an lvalue
7 ---
8 */
9
10 immutable int i;
11 int prop() { return 0; }
12
13 void f1(ref int n = i)
14 {
15 ++n;
16 }
17
18 void f2(out int n = i)
19 {
20 ++n;
21 }
22
23 void f3(ref int n = prop)
24 {
25 ++n;
26 }