mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
19 lines
349 B
Text
19 lines
349 B
Text
`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));
|
|
}
|
|
```
|