Bug 5133 – dmd fails to build rdmd (problem with startsWith)
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2010-10-29T23:39:00Z
Last change time
2010-11-16T13:01:38Z
Assigned to
rsinfu
Creator
bus_dbugzilla
Comments
Comment #0 by bus_dbugzilla — 2010-10-29T23:39:58Z
Regression from 2.049->2.050, using rdmd.d r1400:
>dmd rdmd.d
std.contracts has been scheduled for deprecation. Please use std.exception instead.
rdmd.d(186): Error: template std.algorithm.startsWith(alias pred = "a == b",Range,Ranges...) if (Ranges.length > 1 && isInputRange!(Range) && is(typeof(.startsWith!(pred)(doesThisStart,withOneOfThese[0])) : bool) && is(typeof(.startsWith!(pred)(doesThisStart,withOneOfThese[1..__dollar])) : uint)) does not match any function template declaration
rdmd.d(186): Error: template std.algorithm.startsWith(alias pred = "a == b",Range,Ranges...) if (Ranges.length > 1 && isInputRange!(Range) && is(typeof(.startsWith!(pred)(doesThisStart,withOneOfThese[0])) : bool) && is(typeof(.startsWith!(pred)(doesThisStart,withOneOfThese[1..__dollar])) : uint)) cannot deduce template function from argument types !()(const(immutable(char)[]),string)
Comment #1 by bus_dbugzilla — 2010-10-29T23:59:47Z
Put a reduced test case for this in issue 5134. Made it a separate issue because I think that might be non-trivial to solve, whereas this should be easy to work around.
Comment #2 by bus_dbugzilla — 2010-10-30T00:03:55Z
Workaround:
Change line #183 from:
bool inALibrary(in string source, in string object)
to:
bool inALibrary(string source, in string object)
Comment #3 by sludwig — 2010-10-30T03:59:09Z
I mentioned this also on the beta mailing list; the direct cause are the changes done by David Simcha to avoid code in phobos that relies on issue 3534. I also got this problem for startsWith, but almost all functions working with ranges should be affected by this.
David also proposed a language fix for this that sounds promising, although I did not really think through all the implications: http://www.digitalmars.com/d/archives/digitalmars/D/Proposal_Automatic_shallow_Unqual_on_IFTI_113653.html
The alternative would be to change all functions dealing with ranges that have this issue.