digitalmars.D.bugs - [Issue 24355] New: Slice copy with static arrays incorrect of bounds
- d-bugmail puremagic.com (41/41) Jan 25 https://issues.dlang.org/show_bug.cgi?id=24355
https://issues.dlang.org/show_bug.cgi?id=24355 Issue ID: 24355 Summary: Slice copy with static arrays incorrect of bounds checking Product: D Version: D2 Hardware: x86_64 OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: ryuukk.dev gmail.com ``` void main() { char[32] id = 0; const(char)* str = "hello"; id = str[0 .. 6]; } ``` id is large enough for the string "hello", it should compile instead i get: `` Error: mismatched array lengths 32 and 6 for assignment `id[] = str[0..6] `` ``` void main() { char[4] id; id = "hello asdad"; } ``` is not not large enough, both string and array length are known at compile time, this shouldn't compile error should be: `` Error: mismatched array lengths 4 and 1 for assignment `id[] = "hello asdad" `` --
Jan 25