Bug 21876 – Zero-length static arrays "cannot be read at compile time"
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-04-29T08:31:29Z
Last change time
2021-04-30T03:46:51Z
Keywords
CTFE, pull, rejects-valid
Assigned to
No Owner
Creator
Vladimir Panteleev
Comments
Comment #0 by dlang-bugzilla — 2021-04-29T08:31:29Z
//// test.d ////
auto test()
{
int[0] a;
return a;
}
enum x = test();
////////////////
Comment #1 by dlang-bugzilla — 2021-04-29T08:32:37Z
Compiler output:
test.d(4,9): Error: variable `a` cannot be read at compile time
test.d(7,14): called from here: `test()`
It seems to have worked in 2.053? But not in 2.052 nor any version after it.
Comment #2 by dlang-bot — 2021-04-29T14:20:08Z
@BorisCarvajal created dlang/dmd pull request #12485 "Fix Issue 21876 - Zero-length static arrays "cannot be read at compile time"" fixing this issue:
- Fix Issue 21876 - Zero-length static arrays "cannot be read at compile time"
https://github.com/dlang/dmd/pull/12485
Comment #3 by dlang-bot — 2021-04-30T03:46:51Z
dlang/dmd pull request #12485 "Fix Issue 21876 - Zero-length static arrays "cannot be read at compile time"" was merged into master:
- 7ec016673aa8835256c0391c206ef065169f51ed by Boris Carvajal:
Fix Issue 21876 - Zero-length static arrays "cannot be read at compile time"
https://github.com/dlang/dmd/pull/12485