www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9596] New: Ambiguous match is incorrectly hidden by additional lesser match

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9596

           Summary: Ambiguous match is incorrectly hidden by additional
                    lesser match
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: k.hara.pg gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg gmail.com> 2013-02-26 06:36:34 PST ---
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
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 26 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9596


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2013-02-26 08:39:49 PST ---
https://github.com/D-Programming-Language/phobos/pull/1177
https://github.com/D-Programming-Language/dmd/pull/1409

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 26 2013