Comment #0 by john.loughran.colvin — 2020-06-07T17:02:50Z
% cat test.d
auto blah(void delegate())
{
}
void delegate()[string] r;
static this()
{
void delegate() nothrow a;
r["v"] = a;
}
% dmd -o- -dip25 -dip1000 test.d
test.d(9): Error: cannot implicitly convert expression a of type void delegate() nothrow to void delegate()
This is a super strange error:
`A` isn't used but compilation succeeds if you remove it.
If you make `r` a normal array and do `r[0] = a;` compilation succeeds.
Comment #1 by kinke — 2020-06-07T17:33:10Z
> `A` isn't used but compilation succeeds if you remove it.
That (well, you meant `blah`) makes it definitely interesting - I think it might be related to a missing type merge then, as that's the probable cause for a mangling issue wrt. `void delegate()` too, see https://github.com/ldc-developers/ldc/issues/3098#issuecomment-506527495.
Comment #2 by dlang-bot — 2021-11-05T00:45:04Z
@MoonlightSentinel created dlang/dmd pull request #13267 "Fix 21538,20904: Correct implicitConvTo order for delegate parameters in `Type.covariant`" fixing this issue:
- Fix 21538,20904: Correct implicitConvTo order for delegate parameters...
... in `Type.covariant`
The ordering was inversed when compared to function pointers. That caused
the check to accept e.g. less restrictive attributes for callbacks.
Also changed the equality checks for `TypeFuntion` and `TypeDelegate`
to `equals` because `==` didn't call the former and hence caused problems
for duplicate instances.
https://github.com/dlang/dmd/pull/13267
Comment #3 by dlang-bot — 2021-11-13T12:19:29Z
dlang/dmd pull request #13267 "Fix 21538,20904: Correct implicitConvTo order for delegate parameters in `Type.covariant`" was merged into master:
- f81a1ccaeb0aa3d5575332ceeca4280b5c585d7d by MoonlightSentinel:
Fix 21538,20904: Correct implicitConvTo order for delegate parameters...
... in `Type.covariant`
The ordering was inversed when compared to function pointers. That caused
the check to accept e.g. less restrictive attributes for callbacks.
Also changed the equality checks for `TypeFuntion` and `TypeDelegate`
to `equals` because `==` didn't call the former and hence caused problems
for duplicate instances.
https://github.com/dlang/dmd/pull/13267