D issues are now
tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Summary: |
Dollar sign ($) fails in CTFE function |
Product: |
D
|
Reporter: |
Shire <degener_trash> |
Component: |
dmd | Assignee: |
No Owner <nobody> |
Status: |
RESOLVED
DUPLICATE
|
Severity: |
normal
|
CC: |
bearophile_hugs, clugdbug
|
Priority: |
P2
|
Version: |
D2 |
Hardware: |
x86 |
OS: |
Windows |
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"());
}
Yes, already fixed.
*** This issue has been marked as a duplicate of issue 7770 ***