mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
18 lines
320 B
D
18 lines
320 B
D
module test12486;
|
|
|
|
struct S { enum a = 1; } // or `const` but not for all types
|
|
|
|
S f(ref int i)
|
|
{
|
|
++i;
|
|
return S();
|
|
}
|
|
|
|
void main()
|
|
{
|
|
int i = 2;
|
|
assert(f(i).a == 1);
|
|
// ensure that f(i) was actually called, even though
|
|
// a is a statically known property of the returned type
|
|
assert(i == 3);
|
|
}
|