Bug 24354 – Static arrays are by-reference during CTFE

Status
NEW
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2024-01-23T23:07:46Z
Last change time
2024-12-13T19:32:46Z
Keywords
CTFE, wrong-code
Assigned to
No Owner
Creator
Vladimir Panteleev
See also
https://issues.dlang.org/show_bug.cgi?id=22617
Moved to GitHub: dmd#20387 →

Comments

Comment #0 by dlang-bugzilla — 2024-01-23T23:07:46Z
The following function returns a different result at compile-time vs. runtime: auto fun() { ubyte[1] arr = [0]; auto copy = arr; copy[0] = 42; return arr; } // E.g. void main() { static ct = fun(); assert(ct == fun()); } I think this a regression introduced in https://github.com/dlang/dmd/pull/3467.
Comment #1 by robert.schadek — 2024-12-13T19:32:46Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20387 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB