Bug 11664 – A function with a local static variable is unusable in CTFE

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-12-02T09:34:00Z
Last change time
2013-12-03T16:16:59Z
Keywords
CTFE, pull, rejects-valid
Assigned to
nobody
Creator
samukha

Comments

Comment #0 by samukha — 2013-12-02T09:34:45Z
int foo() { static x = 1; return 0; } enum y = foo(); Error: Static variable x cannot be modified at compile time The static variable is not modified. Equivalent to: int x_private_to_foo = 1; int foo() { return 0; } enum y = foo();
Comment #1 by k.hara.pg — 2013-12-02T17:33:42Z
Comment #2 by github-bugzilla — 2013-12-03T15:53:10Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/cb0c6096e93a9885a269005cd8379a3627112207 fix Issue 11664 - A function with a local static variable is unusable in CTFE https://github.com/D-Programming-Language/dmd/commit/70885936ba13b609df794ab3ead15c24c4afd870 Merge pull request #2917 from 9rnsr/fix11664 Issue 11664 - A function with a local static variable is unusable in CTFE