Bug 17162 – std.algorithm.startsWith fails to compile with -dip1000 switch

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-02-09T06:27:00Z
Last change time
2017-05-01T10:53:09Z
Assigned to
nobody
Creator
monkeyworks12

Comments

Comment #0 by monkeyworks12 — 2017-02-09T06:27:45Z
import std.algorithm; mixin template Property(alias member) if (member.stringof.startsWith('_')) { import std.format: format; import std.range: dropOne; enum mixStrGet = ` @property typeof(member) %s() { return member; } `.format(member.stringof.dropOne()); mixin(mixStrGet); } struct Test { int _n; mixin Property!_n; } Compiler switches: -dip1000 -main Error message: dip100bug.d(4): Error: template std.algorithm.searching.startsWith cannot deduce function from argument types !()(string, char), candidates are: C:\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm\searching.d(3944): std.algorithm.searching.startsWith(alias pred = "a == b", Range, Needles...)(Range doesThisStart, Needles withOneOfThese) if (isInputRange!Range && Needles.length > 1 && is(typeof(.startsWith!pred(doesThisStart, withOneOfThese[0])) : bool) && is(typeof(.startsWith!pred(doesThisStart, withOneOfThese[1..__dollar])) : uint)) C:\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm\searching.d(4017): std.algorithm.searching.startsWith(alias pred = "a == b", R1, R2)(R1 doesThisStart, R2 withThis) if (isInputRange!R1 && isInputRange!R2 && is(typeof(binaryFun!pred(doesThisStart.front, withThis.front)) : bool)) C:\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm\searching.d(4086): std.algorithm.searching.startsWith(alias pred = "a == b", R, E)(R doesThisStart, E withThis) if (isInputRange!R && is(typeof(binaryFun!pred(doesThisStart.front, withThis)) : bool)) C:\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm\searching.d(4096): std.algorithm.searching.startsWith(alias pred, R)(R doesThisStart) if (isInputRange!R && ifTestable!(typeof(doesThisStart.front), unaryFun!pred)) dip100bug.d(23): while looking for match for Property!(_n)
Comment #1 by jack — 2017-02-10T14:49:47Z
Unfortunately, all of Phobos doesn't compile with DIP1000. This is labeled an experimental feature for a reason. This is not a regression by definition, because this functionality did not exist before.
Comment #2 by nick — 2017-04-30T16:50:59Z
Seems to work with v2.074.0, -dip1000.