www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18451] New: rejects-valid since 2.076.1

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

          Issue ID: 18451
           Summary: rejects-valid since 2.076.1
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: var.spool.mail700 gmail.com

this code fails to compile:

void main(){
    import std.algorithm;
    void delegate(void*) dg;
    void delegate(void*)[] dgs = [dg, dg, dg];
    dgs.writeln;
    dgs.remove(1).writeln();
}

if you comment out the line with dgs.writeln;
or if the delegate uses a different type it works as expected.

running all dmd version on run.dlang.io
gives me this output:

Up to      2.075.1: Success with output:
-----
[void delegate(void*), void delegate(void*), void delegate(void*)]
[void delegate(void*), void delegate(void*)]
-----

Since      2.076.1: Failure with output:
-----
/path/to/dmd.linux/dmd2/linux/bin64/../../src/phobos/std/algorithm/mutation.d(1929):
Error: template std.algorithm.mutation.moveAll cannot deduce function from
argument types !()(void delegate(void*)[], void delegate(void*)[]), candidates
are:
/path/to/dmd.linux/dmd2/linux/bin64/../../src/phobos/std/algorithm/mutation.d(1455):
       std.algorithm.mutation.moveAll(InputRange1, InputRange2)(InputRange1
src, InputRange2 tgt) if (isInputRange!InputRange1 && isInputRange!InputRange2
&& is(typeof(move(src.front, tgt.front))))
onlineapp.d(7): Error: template instance
std.algorithm.mutation.remove!(cast(SwapStrategy)2, void delegate(void*)[],
int) error instantiating

forum discussion:
https://forum.dlang.org/post/p66nvj$1g0a$1 digitalmars.com

--
Feb 16 2018