8419 – Dollar sign ($) fails in CTFE function

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 8419 - Dollar sign ($) fails in CTFE function
Summary: Dollar sign ($) fails in CTFE function
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:
Depends on:
Blocks:
Reported: 2012年07月23日 02:55 UTC by Shire
Modified: 2012年07月24日 07:10 UTC (History)
2 users (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Shire 2012年07月23日 02:55:29 UTC
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 bearophile_hugs 2012年07月23日 04:55:04 UTC
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 Don 2012年07月24日 07:10:28 UTC
Yes, already fixed.
*** This issue has been marked as a duplicate of issue 7770 ***


AltStyle によって変換されたページ (->オリジナル) /