D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7527 - [CTFE] Segfault when slicing a pointer at compile time
Summary: [CTFE] Segfault when slicing a pointer at compile time
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: CTFE, ice
: 7638 (view as issue list)
Depends on:
Blocks:
 
Reported: 2012-02-16 15:35 UTC by Robert Clipsham
Modified: 2012-03-11 12:51 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Robert Clipsham 2012-02-16 15:35:18 UTC
When compiling the following code:
----
char[] replace(char[] subject)
{
    auto app = Appender();

    app.data.ptr[0..subject.length] = subject;
    return app.data;
}

struct Appender
{
    char[] data;
}
enum foo = replace("$a = ?".dup);
----
With dmd 2.058, dmd gives the following:
----
$ dmd test.d 
test.d(5): Error: pointer cast from char[] to char* is not supported at compile time
Segmentation fault: 11
----
Comment 2 github-bugzilla 2012-02-17 16:05:26 UTC
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/df8183e4046793b5d5cb61bf96a16eb94c7ac2e3
fix Issue 7527 - [CTFE] Segfault when slicing a pointer at compile time
Comment 3 timon.gehr 2012-03-11 12:51:31 UTC
*** Issue 7638 has been marked as a duplicate of this issue. ***