[Issue 20400] New: CTFE increasing length of array of characters changes its value
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Nov 16 23:47:53 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=20400
Issue ID: 20400
Summary: CTFE increasing length of array of characters changes
its value
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: sahmi.soulaimane at gmail.com
Test case:
```
auto test()
{
char[] s = cast(char[])"1234";
char[] ret = s[2 .. $];
ret.length += 1;
ret[$-1] = '5';
return ret;
}
pragma(msg, test());
```
output: 125
expected: 345
--
More information about the Digitalmars-d-bugs
mailing list