[Issue 14735] [REG2.068-b1] std.string.indexOf cannot deduce function for char argument

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Jun 27 05:34:19 PDT 2015


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

--- Comment #7 from Kenji Hara <k.hara.pg at gmail.com> ---
Sorry, this is a compiler bug, because of the incomplete implementation for the
language enhancement from 2.063.

Code to illustrate issue.

int foo(Range      )(Range    s, in dchar c) { return 1; }  // A
int foo(T, size_t n)(ref T[n] s, in dchar c) { return 2; }  // B

void main()
{
    char[64] buf;

    // Supported from 2.063: (http://dlang.org/changelog#implicitarraycast)
    assert(foo(buf[0..32], '\0') == 2);

    // Not yet supported case (it's a compiler bug)
    assert(foo(buf[], '\0') == 2);
}

In both cases (buf[0..23] and buf[]), the foo calls should match to B, because
it's specialized version to the static array argument than A.

--


More information about the Digitalmars-d-bugs mailing list