mirror of
https://github.com/dlang/dmd.git
synced 2025-04-27 05:30:13 +03:00
Update dmd.reflocal.dd to include auto ref
(#16772)
This commit is contained in:
parent
c24631b2d4
commit
8dabb67ee5
1 changed files with 6 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
||||||
`ref` can now be applied to local, static, extern, and global variables
|
`ref` and `auto ref` can now be applied to local, static, extern, and global variables
|
||||||
|
|
||||||
For example, one can now write:
|
For example, one can now write:
|
||||||
```
|
```
|
||||||
|
@ -10,5 +10,10 @@ void main()
|
||||||
ref int r = s.a;
|
ref int r = s.a;
|
||||||
r = 3;
|
r = 3;
|
||||||
assert(s.a == 3);
|
assert(s.a == 3);
|
||||||
|
|
||||||
|
auto ref x = 0;
|
||||||
|
auto ref y = x;
|
||||||
|
static assert(!__traits(isRef, x));
|
||||||
|
static assert( __traits(isRef, y));
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue