Bug 17837 – Static array initializers longer than array length should not be allowed

Status
NEW
Severity
minor
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-09-18T05:42:32Z
Last change time
2024-12-13T18:54:33Z
Keywords
accepts-invalid
Assigned to
No Owner
Creator
Vladimir Panteleev
Moved to GitHub: dmd#19318 →

Comments

Comment #0 by dlang-bugzilla — 2017-09-18T05:42:32Z
void main() { char[2] str = "0123456789abcdef"; }
Comment #1 by b2.temp — 2017-09-18T06:22:19Z
Yes but your example is not a static array initializer. This is a simple non-void initializer that consists of an unary expression converted at run-time. Better example: char[2] str = ['0','1','2']; And actually this is already static cally checked.
Comment #2 by robert.schadek — 2024-12-13T18:54:33Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19318 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB