dmd/changelog/dmd.auto-ref-local.dd
2025-02-14 08:23:16 +08:00

19 lines
365 B
Text

Storage classes `ref` and `auto ref` can now be applied to local, static, extern, and global variables
For example, one can now write:
```
struct S { int a; }
void main()
{
S s;
ref int r = s.a;
r = 3;
assert(s.a == 3);
auto ref x = 0;
auto ref y = x;
static assert(!__traits(isRef, x));
static assert( __traits(isRef, y));
}
```