D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.

Issue 8419

Summary: Dollar sign ($) fails in CTFE function
Product: D Reporter: Shire <degener_trash>
Component: dmdAssignee: No Owner <nobody>
Status: RESOLVED DUPLICATE
Severity: normal CC: bearophile_hugs, clugdbug
Priority: P2
Version: D2
Hardware: x86
OS: Windows

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 によって変換されたページ (->オリジナル) /