[Issue 17162] New: std.algorithm.startsWith fails to compile with -dip1000 switch

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Feb 8 22:27:45 PST 2017


https://issues.dlang.org/show_bug.cgi?id=17162

          Issue ID: 17162
           Summary: std.algorithm.startsWith fails to compile with
                    -dip1000 switch
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: monkeyworks12 at hotmail.com

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)

--


More information about the Digitalmars-d-bugs mailing list