Bug 9596 – Ambiguous match is incorrectly hidden by additional lesser match

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-02-26T06:36:00Z
Last change time
2014-04-22T05:11:34Z
Keywords
accepts-invalid, pull
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2013-02-26T06:36:34Z
From std.traits.AssocArrayTypeOf. In the below, 'x' and 'y' are both ambiguous each other if it is called with shared(int)[int] argument, but that will be hidden by adding lesser match 'z'. void idzp1(K, V)(inout( V [K])) { pragma(msg, "x:", V); } void idzp1(K, V)(inout(shared(V) [K])) { pragma(msg, "y:", V); } void idzp2(K, V)(inout( V [K])) { pragma(msg, "x:", V); } void idzp2(K, V)(inout( const(V) [K])) { pragma(msg, "z:", V); } void idzp3(K, V)(inout(shared(V) [K])) { pragma(msg, "y:", V); } void idzp3(K, V)(inout( const(V) [K])) { pragma(msg, "z:", V); } void idzp4(K, V)(inout( V [K])) { pragma(msg, "x:", V); } void idzp4(K, V)(inout(shared(V) [K])) { pragma(msg, "y:", V); } void idzp4(K, V)(inout( const(V) [K])) { pragma(msg, "z:", V); } void idzp5(K, V)(inout(shared(V) [K])) { pragma(msg, "y:", V); } void idzp5(K, V)(inout( V [K])) { pragma(msg, "x:", V); } void idzp5(K, V)(inout( const(V) [K])) { pragma(msg, "z:", V); } void main() { shared(int)[int] aa; idzp1(aa); // make "matches more than one declaration" error, OK idzp2(aa); // matches "x", OK idzp3(aa); // matches "y", OK // these means: x == y, x > z, y > z idzp4(aa); // should be ambiguous with x and y, but incorrectly matches x idzp5(aa); // should be ambiguous with x and y, but incorrectly matches y }
Comment #1 by k.hara.pg — 2013-02-26T08:39:49Z