D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 19618 - Incorrect conversion of function returning `typeof(null)` to function returning an associative array
Summary: Incorrect conversion of function returning `typeof(null)` to function returni...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 All
: P1 regression
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-26 11:19 UTC by Iain Buclaw
Modified: 2019-03-10 19:01 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Iain Buclaw 2019-01-26 11:19:19 UTC
Fix for issue 8589 was incomplete.

---
void f(int[int] function() del)
{
    assert(!del());
}

typeof(null) g() { return null; }

void main()
{
    f(&g);
    f(() => null);
}
---

As typeof(null) is a pointer type, whilst associative arrays are value types.  So can't possibly be covariant.
Comment 1 Iain Buclaw 2019-02-10 17:10:32 UTC
It seems that the got auto-resolved without linking a reference to the PR nor commit.


https://github.com/dlang/dmd/pull/9272
Comment 2 Dlang Bot 2019-03-10 19:01:11 UTC
dlang/dmd pull request #9435 "[dmd-cxx] fix Issue 19618 - Associative arrays are not covariant with typeof(null)" was merged into dmd-cxx:

- c9d1c94080a5fc233ce4bdf9ebd3f07ba224e9dd by Iain Buclaw:
  fix Issue 19618 - Associative arrays are not covariant with typeof(null)
  
  As associative arrays are value types (`struct {void*}`), which are
  passed and returned differently to the void pointer typeof(null).

https://github.com/dlang/dmd/pull/9435