http://d.puremagic.com/issues/show_bug.cgi?id=4217

           Summary: Function overloads are not distinguished when
                    instantiating templates
           Product: D
           Version: 2.041
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: patch, wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: rsi...@gmail.com


--- Comment #0 from Shin Fujishiro <rsi...@gmail.com> 2010-05-21 04:32:09 PDT 
---
Created an attachment (id=639)
Patch for DMD svn r496

--------------------
interface I
{
    int test(int);
    real test(real);
}
pragma(msg, typeof(__traits(getOverloads, I, "test")));

template Test(alias func) { pragma(msg, "Test: ", typeof(func)); }
alias Test!(__traits(getOverloads, I, "test")[0]) Test0;
alias Test!(__traits(getOverloads, I, "test")[1]) Test1;

static assert(!__traits(isSame, Test0, Test1));
--------------------
(int(int), real(real))
Test: int(int)
test.d(12): Error: static assert  (!true) is false
--------------------

There is no "Test: real(real)" in the output.  And the two aliases are reported
as the same; the first instance Test0 is reused for the second instantiation
(Test1).

The attached patch fixes the problem by adding a check for overloaded functions
to the match() function in template.c.

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

Reply via email to