Bug 8419 – Dollar sign ($) fails in CTFE function

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2012-07-23T02:55:00Z
Last change time
2012-07-24T07:10:28Z
Assigned to
nobody
Creator
degener_trash

Comments

Comment #0 by degener_trash — 2012-07-23T02:55:29Z
DMD v2.059 pure string foo(string s)() { uint fromPos = 2; // return s[fromPos..$]; // fails on CTFE with // Assertion failure: '!v->isDataseg() || v->isCTFE()' on line 108 in file 'interpret.c' return s[fromPos..s.length]; // OK // return s[2..$]; // Also OK } int main(string[] args) { // pragma(msg, foo!"12345"()); // fails string s = foo!"12345"(); // OK in all cases return 0; }
Comment #1 by bearophile_hugs — 2012-07-23T04:55:04Z
This program runs with no errors on DMD 2.060alpha: pure string foo(string s)() { uint fromPos = 2; return s[fromPos .. $]; } void main() { pragma(msg, foo!"12345"()); }
Comment #2 by clugdbug — 2012-07-24T07:10:28Z
Yes, already fixed. *** This issue has been marked as a duplicate of issue 7770 ***