D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7771 - [ICE][CTFE] With maketrans and string slicing
Summary: [ICE][CTFE] With maketrans and string slicing
Status: RESOLVED DUPLICATE of issue 7770
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: CTFE, rejects-valid
Depends on:
Blocks:
 
Reported: 2012-03-25 12:19 UTC by bearophile_hugs
Modified: 2012-04-04 11: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 bearophile_hugs 2012-03-25 12:19:38 UTC
import std.ascii: letters, uppercase;
import std.string: maketrans;
immutable r = maketrans(uppercase, uppercase[13 .. $] ~ uppercase[0 .. 13]);
void main() {}


DMD 2.059head:

Assertion failure: '!v->isDataseg() || v->isCTFE()' on line 108 in file 'interpret.c'


With small changes it crashes in another point:


import std.string: maketrans;
void main() {
    immutable s = "foo";
    static r = maketrans(s, s[0 .. $]);
}


DMD 2.059head:

Assertion failure: 'v->ctfeAdrOnStack >= 0 && v->ctfeAdrOnStack < stackPointer()' on line 97 in file 'interpret.c'
Comment 1 Don 2012-04-04 11:57:54 UTC
Patch for bug 7770 fixes this.

*** This issue has been marked as a duplicate of issue 7770 ***