Bug 12403 – [AA] Associative array `get` function rejects some cases

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-03-18T07:04:00Z
Last change time
2014-04-18T08:39:16Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
verylonglogin.reg

Comments

Comment #0 by verylonglogin.reg — 2014-03-18T07:04:47Z
This code used to work: --- void main() { const(int)[int] m; assert(m.get(0, 1) == 1); } --- main.d(4): Error: template object.get cannot deduce function from argument types !()(const(int)[int], int, int), candidates are: <druntime-root>\import\object.di(480): object.get(K, V)(inout(V[K]) aa, K key, lazy inout(V) defaultValue) <druntime-root>\import\object.di(486): object.get(K, V)(inout(V[K])* aa, K key, lazy inout(V) defaultValue) ---
Comment #1 by dlang-bugzilla — 2014-03-18T17:21:07Z
Introduced in https://github.com/D-Programming-Language/druntime/pull/733 Possibly related: Issue 12316
Comment #2 by dlang-bugzilla — 2014-03-23T07:38:05Z
I guess it's not related to issue 12316, because the pull that fixed it did not fix this issue.
Comment #3 by k.hara.pg — 2014-04-17T04:11:39Z
This is a compiler issue that current IFTI cannot deduce correct type parameters for the case: void test12403() { void func(K, V)(inout(V[K]) aa) { static assert(is(V == const int)); static assert(is(K == int)); } const(int)[int] m; func(m); // fails, but should work } https://github.com/D-Programming-Language/dmd/pull/3465
Comment #4 by github-bugzilla — 2014-04-18T08:39:15Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/8cbc11d4a398e5cd4e4ad487d2e81c607544be5b fix Issue 12403 - [AA] Associative array `get` function rejects some cases https://github.com/D-Programming-Language/dmd/commit/b4743e8489f633951992c8b638b5e86df9bc63d1 Merge pull request #3465 from 9rnsr/fix12403 [REG2.066a] Issue 12403 - [AA] Associative array `get` function rejects some cases