Thread overview | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
February 16, 2018 is this a bug with writeln / std.algorithm.remove? | ||||
---|---|---|---|---|
| ||||
this code fails to compile: void delegate(void*) dg; void delegate(void*)[] dgs = [dg, dg, dg]; dgs.writeln; dgs.remove(1).writeln(); if you comment out dgs.writeln; it works as expected, it works if you use other types then void*: void delegate(int*) dg; void delegate(int*)[] dgs = [dg, dg, dg]; dgs.writeln; dgs.remove(1).writeln(); the compiler is DMD64 D Compiler v2.078.2 and the error message is: /usr/include/dlang/dmd/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: /usr/include/dlang/dmd/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)))) empty.d(9): Error: template instance std.algorithm.mutation.remove!(cast(SwapStrategy)2, void delegate(void*)[], int) error instantiating |
February 16, 2018 Re: is this a bug with writeln / std.algorithm.remove? | ||||
---|---|---|---|---|
| ||||
Posted in reply to arturg | On Friday, 16 February 2018 at 11:45:21 UTC, arturg wrote: > this code fails to compile: > > void delegate(void*) dg; > void delegate(void*)[] dgs = [dg, dg, dg]; > dgs.writeln; > dgs.remove(1).writeln(); > > if you comment out dgs.writeln; it works as expected, > it works if you use other types then void*: > > void delegate(int*) dg; > void delegate(int*)[] dgs = [dg, dg, dg]; > dgs.writeln; > dgs.remove(1).writeln(); > > > the compiler is DMD64 D Compiler v2.078.2 and the error message is: > > /usr/include/dlang/dmd/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: > /usr/include/dlang/dmd/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)))) > empty.d(9): Error: template instance std.algorithm.mutation.remove!(cast(SwapStrategy)2, void delegate(void*)[], int) error instantiating 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 ----- |
February 16, 2018 Re: is this a bug with writeln / std.algorithm.remove? | ||||
---|---|---|---|---|
| ||||
Posted in reply to arturg | On Friday, 16 February 2018 at 12:15:07 UTC, arturg wrote:
> On Friday, 16 February 2018 at 11:45:21 UTC, arturg wrote:
>> this code fails to compile:
>>
>> void delegate(void*) dg;
>> void delegate(void*)[] dgs = [dg, dg, dg];
>> dgs.writeln;
>> dgs.remove(1).writeln();
>>
>> if you comment out dgs.writeln; it works as expected,
>> it works if you use other types then void*:
>>
>> void delegate(int*) dg;
>> void delegate(int*)[] dgs = [dg, dg, dg];
>> dgs.writeln;
>> dgs.remove(1).writeln();
>>
>>
>> the compiler is DMD64 D Compiler v2.078.2 and the error message is:
>>
>> /usr/include/dlang/dmd/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:
>> /usr/include/dlang/dmd/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))))
>> empty.d(9): Error: template instance std.algorithm.mutation.remove!(cast(SwapStrategy)2, void delegate(void*)[], int) error instantiating
>
> 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
> -----
It's definitely a bug, the question is what change has caused it.
|
February 16, 2018 Re: is this a bug with writeln / std.algorithm.remove? | ||||
---|---|---|---|---|
| ||||
Posted in reply to bauss | On Friday, 16 February 2018 at 13:08:09 UTC, bauss wrote:
> On Friday, 16 February 2018 at 12:15:07 UTC, arturg wrote:
>> On Friday, 16 February 2018 at 11:45:21 UTC, arturg wrote:
>>> this code fails to compile:
>>>
>>> void delegate(void*) dg;
>>> void delegate(void*)[] dgs = [dg, dg, dg];
>>> dgs.writeln;
>>> dgs.remove(1).writeln();
>>>
>>> if you comment out dgs.writeln; it works as expected,
>>> it works if you use other types then void*:
>>>
>>> void delegate(int*) dg;
>>> void delegate(int*)[] dgs = [dg, dg, dg];
>>> dgs.writeln;
>>> dgs.remove(1).writeln();
>>>
>>>
>>> the compiler is DMD64 D Compiler v2.078.2 and the error message is:
>>>
>>> /usr/include/dlang/dmd/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:
>>> /usr/include/dlang/dmd/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))))
>>> empty.d(9): Error: template instance std.algorithm.mutation.remove!(cast(SwapStrategy)2, void delegate(void*)[], int) error instantiating
>>
>> 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
>> -----
>
> It's definitely a bug, the question is what change has caused it.
Looking at "moveAll" which is the one that causes the error, no changes has been made to that which could cause this as within the last 3 months only changes made to it has been two asserts that has been inserted. Other than that has only been a documentation change a year ago and prior to that changes hasn't been made to it for 3 years.
So it's a bug in the compiler, rather than Phobos itself.
|
February 16, 2018 Re: is this a bug with writeln / std.algorithm.remove? | ||||
---|---|---|---|---|
| ||||
Posted in reply to bauss | On 2/16/18 8:16 AM, bauss wrote:
> On Friday, 16 February 2018 at 13:08:09 UTC, bauss wrote:
>> On Friday, 16 February 2018 at 12:15:07 UTC, arturg wrote:
>>> On Friday, 16 February 2018 at 11:45:21 UTC, arturg wrote:
>>>> this code fails to compile:
>>>>
>>>> void delegate(void*) dg;
>>>> void delegate(void*)[] dgs = [dg, dg, dg];
>>>> dgs.writeln;
>>>> dgs.remove(1).writeln();
>>>>
>>>> if you comment out dgs.writeln; it works as expected,
>>>> it works if you use other types then void*:
>>>>
>>>> void delegate(int*) dg;
>>>> void delegate(int*)[] dgs = [dg, dg, dg];
>>>> dgs.writeln;
>>>> dgs.remove(1).writeln();
>>>>
>>>>
>>>> the compiler is DMD64 D Compiler v2.078.2 and the error message is:
>>>>
>>>> /usr/include/dlang/dmd/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:
>>>> /usr/include/dlang/dmd/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))))
>>>> empty.d(9): Error: template instance std.algorithm.mutation.remove!(cast(SwapStrategy)2, void delegate(void*)[], int) error instantiating
>>>
>>> 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
>>> -----
>>
>> It's definitely a bug, the question is what change has caused it.
>
> Looking at "moveAll" which is the one that causes the error, no changes has been made to that which could cause this as within the last 3 months only changes made to it has been two asserts that has been inserted. Other than that has only been a documentation change a year ago and prior to that changes hasn't been made to it for 3 years.
>
> So it's a bug in the compiler, rather than Phobos itself.
>
Strictly speaking, this is not necessarily proof that it's in phobos, there could have been changes elsewhere that cause one of the conditions to fail.
However, testing this out, I found something very weird.
If you pragma(msg, isInputRange!(typeof(dgs))); inside your file, then it compiles (and prints true for that pragma).
Makes no sense at all. Definitely seems like a compiler bug. A pragma(msg) shouldn't affect the outcome.
-Steve
|
February 16, 2018 Re: is this a bug with writeln / std.algorithm.remove? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On Friday, 16 February 2018 at 13:28:59 UTC, Steven Schveighoffer wrote:
>
> Strictly speaking, this is not necessarily proof that it's in phobos, there could have been changes elsewhere that cause one of the conditions to fail.
>
> However, testing this out, I found something very weird.
>
> If you pragma(msg, isInputRange!(typeof(dgs))); inside your file, then it compiles (and prints true for that pragma).
>
> Makes no sense at all. Definitely seems like a compiler bug. A pragma(msg) shouldn't affect the outcome.
>
> -Steve
ok so what should the bug report look like?
|
February 16, 2018 Re: is this a bug with writeln / std.algorithm.remove? | ||||
---|---|---|---|---|
| ||||
Posted in reply to arturg | On 2/16/18 8:51 AM, arturg wrote:
> On Friday, 16 February 2018 at 13:28:59 UTC, Steven Schveighoffer wrote:
>>
>> Strictly speaking, this is not necessarily proof that it's in phobos, there could have been changes elsewhere that cause one of the conditions to fail.
>>
>> However, testing this out, I found something very weird.
>>
>> If you pragma(msg, isInputRange!(typeof(dgs))); inside your file, then it compiles (and prints true for that pragma).
>>
>> Makes no sense at all. Definitely seems like a compiler bug. A pragma(msg) shouldn't affect the outcome.
>>
>
> ok so what should the bug report look like?
You have a pretty good minimal test, put that in bugzilla along with the forum thread link and all the info we know. Mark it as a dmd bug, regression, along with the version where it regressed (2.076.1), and I would tag it as "rejects-valid"
-Steve
|
February 16, 2018 Re: is this a bug with writeln / std.algorithm.remove? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On Friday, 16 February 2018 at 13:57:07 UTC, Steven Schveighoffer wrote: > > You have a pretty good minimal test, put that in bugzilla along with the forum thread link and all the info we know. Mark it as a dmd bug, regression, along with the version where it regressed (2.076.1), and I would tag it as "rejects-valid" > > -Steve ok done https://issues.dlang.org/show_bug.cgi?id=18451 |
Copyright © 1999-2021 by the D Language Foundation