[Issue 24729] New: Can't declare global ref variable
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Aug 28 15:56:27 UTC 2024
https://issues.dlang.org/show_bug.cgi?id=24729
Issue ID: 24729
Summary: Can't declare global ref variable
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: nick at geany.org
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.
--
More information about the Digitalmars-d-bugs
mailing list