Bug 19618 – Incorrect conversion of function returning `typeof(null)` to function returning an associative array

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2019-01-26T11:19:19Z
Last change time
2019-03-10T19:01:11Z
Assigned to
No Owner
Creator
Iain Buclaw

Comments

Comment #0 by ibuclaw — 2019-01-26T11:19:19Z
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 by ibuclaw — 2019-02-10T17:10:32Z
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 by dlang-bot — 2019-03-10T19:01:11Z
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