[Issue 24355] Slice copy with static arrays incorrect bounds checking

2024-01-26 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24355 --- Comment #5 from Nick Treleaven --- Spec for above: > A string literal converts to a static array rvalue of the same or longer > length https://dlang.org/spec/expression.html#string_literals --

[Issue 24355] Slice copy with static arrays incorrect bounds checking

2024-01-26 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24355 --- Comment #4 from Nick Treleaven --- > An array *initializer* is allowed to have fewer elements. Actually that only seems to apply when the initializer is a string literal. char[4] s = [1]; // error char[4] s = "a"; // OK --

[Issue 24355] Slice copy with static arrays incorrect bounds checking

2024-01-26 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24355 Nick Treleaven changed: What|Removed |Added CC||n...@geany.org --- Comment #3 from Nick

[Issue 24355] Slice copy with static arrays incorrect bounds checking

2024-01-25 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24355 --- Comment #2 from ryuukk_ --- I expect the same as: ``` void main() { char[32] id = "hello"; } ``` left: static array right: slice result: slice -> copy -> [0 .. slice.length] --

[Issue 24355] Slice copy with static arrays incorrect bounds checking

2024-01-25 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24355 --- Comment #1 from anonymous4 --- In case 1 it's unclear what you want, it can be id[0..6]=str[0..6] or id[0..6]=str[0..6],id[6..12]=str[0..6],... - pattern copy. --

[Issue 24355] Slice copy with static arrays incorrect bounds checking

2024-01-25 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24355 ryuukk_ changed: What|Removed |Added Summary|Slice copy with static |Slice copy with static |arrays