Bug 7638 – [CTFE] std.array.replace causes a segfault at compile time while replacing the begining of a string
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-03-03T17:51:00Z
Last change time
2012-03-11T12:51:31Z
Keywords
CTFE, diagnostic, ice
Assigned to
nobody
Creator
kajetan.rzepecki+puremagic
Comments
Comment #0 by kajetan.rzepecki+puremagic — 2012-03-03T17:51:22Z
The code:
enum f = "foo";
enum s0 = f.replace("oo", "bar");
enum s1 = f.replace("fo", "bar");
...results in:
/usr/include/d/dmd/phobos/std/array.d(2054): Error: pointer cast from char[] to char* is not supported at compile time
Segmentation fault
...under DMD64 2.058 on Linux.
It seems to segfault while appending new characters only when replacing the begining of a string at compile time. Replacing anything else works just fine.
Comment #1 by timon.gehr — 2012-03-11T12:51:31Z
*** This issue has been marked as a duplicate of issue 7527 ***