www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4986] New: IFTI fails on partial matching with value parameters

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

           Summary: IFTI fails on partial matching with value parameters
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: simen.kjaras gmail.com



PDT ---
The following code fails to deduce the value of m2 in bar:

struct Foo( int n, int m ) {
    /// Bugged:
    void bar( int m2 )( Foo!( m2, n ) arg ) {}
    // Workaround:
    void baz( int n2, int m2 )( Foo!( n2, m2 ) arg ) if ( n == n2 ) {}
}

void bug( )( ) {
    Foo!(3,2) f;
    Foo!(3,3) g;
    f.baz( g ); // Works.
    f.bar( g ); // Fails.
}

foo.d(14): Error: template foo.Foo!(3,2).Foo.bar(int m2) does not match any
func
tion template declaration
foo.d(14): Error: template foo.Foo!(3,2).Foo.bar(int m2) cannot deduce template
function from argument types !()(Foo!(3,3))


Note also that this works for type parameters:

struct Foo( T, U ) {
    void bar( V )( Foo!( T, V ) arg ) {}
}

void bug( )( ) {
    Foo!(int, float) f;
    Foo!(int, string) g;
    f.bar( g );
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 04 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4986


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



Works in 2.060head.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 30 2012