[Issue 14791] std.string.indexOf(char[], char) no longer compiles

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Jul 11 03:42:46 PDT 2015


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

Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|phobos                      |dmd

--- Comment #2 from Walter Bright <bugzilla at digitalmars.com> ---
Test case:

  import std.range;

  void indexOf(Range)(Range s, bool cs = true) if (isInputRange!Range) { }

  void indexOf(T, size_t n)(ref T[n] s, bool cs = true) { }

  void test() {
    char[64] buf;
    indexOf(buf[]);
  }

Results:

  Error: template foo.indexOf cannot deduce function from argument types !() 
(char[]), candidates are:
      foo.indexOf(Range)(Range s, bool cs = true) if (isInputRange!Range)
      foo.indexOf(T, uint n)(ref T[n] s, bool cs = true)

Now, the peculiar thing is, if we remove the "bool cs = true" from both
templates, it compiles without error.

This is definitely a dmd bug, not a Phobos bug.

--


More information about the Digitalmars-d-bugs mailing list