July 28, 2021 [Issue 22154] New: Pure functions should be able to use only the address of a global | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22154 Issue ID: 22154 Summary: Pure functions should be able to use only the address of a global Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: andrei@erdani.com Consider: __gshared int a; pure int fun(int* x) { if (x == &a) return 1; return 42; } This does not compile. However, it does not depend on global modifiable state because the address of a global is a runtime invariant. -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply