Bug 24729 – Can't declare global ref variable

Status
NEW
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2024-08-28T15:56:27Z
Last change time
2024-12-13T19:37:06Z
Assigned to
No Owner
Creator
Nick Treleaven
Moved to GitHub: dmd#20503 →

Comments

Comment #0 by nick — 2024-08-28T15:56:27Z
The 2.111 pending changelog says: > ref and auto ref can now be applied to local, static, extern, and global variables https://dlang.org/changelog/pending.html#dmd.reflocal But globals don't seem to work: struct Foo { int a; } Foo foo; ref f = foo; // Error: static variable `foo` cannot be read at compile time ref a = foo.a; // Error: static variable `foo` cannot be read at compile time `f` could be just an alias so to be useful, `a` needs to be supported. Assuming ref globals are supposed to work. The only ref variable tests I found are in test/runnable/declaration.d, and none are global variables.
Comment #1 by robert.schadek — 2024-12-13T19:37:06Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20503 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB