Debian Codegraph @

gcc/testsuite/gdc.test/runnable/test12486.d

raw
1 module test12486;
2
3 struct S { enum a = 1; } // or `const` but not for all types
4
5 S f(ref int i)
6 {
7 ++i;
8 return S();
9 }
10
11 void main()
12 {
13 int i = 2;
14 assert(f(i).a == 1);
15 // ensure that f(i) was actually called, even though
16 // a is a statically known property of the returned type
17 assert(i == 3);
18 }