www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14735] New: [REG2.068-b1] std.string.indexOf cannot deduce

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

          Issue ID: 14735
           Summary: [REG2.068-b1] std.string.indexOf cannot deduce
                    function for char argument
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: pro.mathias.lang gmail.com

The following code compiled fine in 2.067:
```
void main()
{
  import std.string;
  enum Test = "Hello\0World";
  char[64] foo;
  foo[0 .. Test.length] = Test[];
  auto greetings = foo[0 .. foo[].indexOf('\0')];
}
```

But now it outputs:

Error: template std.string.indexOf cannot deduce function from argument types
!()(char[], char), candidates are:
/home/travis/dmd2/linux/bin64/../../src/phobos/std/string.d(346):       
std.string.indexOf(Range)(Range s, in dchar c, in CaseSensitive cs =
CaseSensitive.yes) if (isInputRange!Range &&
isSomeChar!(ElementEncodingType!Range))
/home/travis/dmd2/linux/bin64/../../src/phobos/std/string.d(471):       
std.string.indexOf(T, ulong n)(ref T[n] s, in dchar c, in CaseSensitive cs =
CaseSensitive.yes) if (isSomeChar!T)
/home/travis/dmd2/linux/bin64/../../src/phobos/std/string.d(544):       
std.string.indexOf(Range)(Range s, in dchar c, in size_t startIdx, in
CaseSensitive cs = CaseSensitive.yes) if (isInputRange!Range &&
isSomeChar!(ElementEncodingType!Range))
/home/travis/dmd2/linux/bin64/../../src/phobos/std/string.d(640):       
std.string.indexOf(Range, Char)(Range s, const(Char)[] sub, in CaseSensitive cs
= CaseSensitive.yes) if (isForwardRange!Range &&
isSomeChar!(ElementEncodingType!Range) && isSomeChar!Char)
/home/travis/dmd2/linux/bin64/../../src/phobos/std/string.d(793):       
std.string.indexOf(Char1, Char2)(const(Char1)[] s, const(Char2)[] sub, in
size_t startIdx, in CaseSensitive cs = CaseSensitive.yes) if (isSomeChar!Char1
&& isSomeChar!Char2)


This affects Vibe.d

--
Jun 25 2015