Thread overview
[Issue 8373] New: IFTI fails on overloading of function vs non function template
Jul 10, 2012
timon.gehr@gmx.ch
Jul 10, 2012
Jonathan M Davis
Jul 10, 2012
timon.gehr@gmx.ch
July 10, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8373

           Summary: IFTI fails on overloading of function vs non function
                    template
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: timon.gehr@gmx.ch


--- Comment #0 from timon.gehr@gmx.ch 2012-07-10 13:39:52 PDT ---
DMD 2.059:
auto fun(T...)(T args){return 1;}
template fun(a...){auto fun(T...)(T args){return 2;}}
static assert(fun(0)==1); // error

The call matches only the first declaration, therefore the overload resolution should succeed.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 10, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8373


Jonathan M Davis <jmdavisProg@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg@gmx.com


--- Comment #1 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-07-10 13:49:31 PDT ---
This looks very similar to bug# 8316, but I'm not sure if it's the same thing.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 10, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8373



--- Comment #2 from timon.gehr@gmx.ch 2012-07-10 13:55:43 PDT ---
(In reply to comment #1)
> This looks very similar to bug# 8316, but I'm not sure if it's the same thing.

Thank you for looking that up, but it is a different issue.

The underlying problem in bug# 8316 is that the compiler does not interpret the statement as a function call, and therefore the instantiation is ambiguous.

In this case the compiler errors out on the matching template with the error message that would be adequate if only the non-matching template was present.

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