D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6516 - Regression(2.055 beta) [CTFE] ICE(constfold.c) involving new dchar[]
Summary: Regression(2.055 beta) [CTFE] ICE(constfold.c) involving new dchar[]
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 regression
Assignee: No Owner
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2011-08-16 22:57 UTC by Nick Sabalausky
Modified: 2011-08-24 12:57 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 Nick Sabalausky 2011-08-16 22:57:45 UTC
dstring foo()
{
    return cast(dstring) new dchar[](0);
}
static assert(foo() == ""d);
Comment 1 Nick Sabalausky 2011-08-16 23:41:16 UTC
I think this may be another manifestation of the same bug:

dstring foo()
{
    auto result = new dchar[](1);
    result[0..1] = "a"d;
    return cast(dstring)result;
}
static assert(foo() == "a"d);

Result:
assert interpret.c(2831) sz == newstr->sz