www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1178] New: templates - deduction + specialization won't compile

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

           Summary: templates - deduction + specialization won't compile
           Product: D
           Version: 1.013
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: leo.dahlmann gmail.com


The following code won't compile with these error messages:

templates.d(11): template templates.test!(double).foo(T) does not match any
temp
late declaration
templates.d(11): template templates.test!(double).foo(T) cannot deduce template
function from argument types (double,char[2])

template test(R)
{
        R foo(T)(float x, T param)
        {
                return cast(R)x;
        }
}

void main()
{
        test!(double).foo(5.0, "hi");
}


-- 
Apr 23 2007
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1178


thomas-dloop kuehne.cn changed:

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





Workaround:
use "5.0f" in istead of "5.0"

*** This bug has been marked as a duplicate of 617 ***


-- 
Apr 27 2007