www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9707] New: Template argument deduction does not work with static methods of shared class

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

           Summary: Template argument deduction does not work with static
                    methods of shared class
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: weltensturm gmail.com


--- Comment #0 from Robert Luger <weltensturm gmail.com> 2013-03-12 12:04:37
PDT ---
When passing arguments to a static shared template method, DMD is unable to
deduce types. Code:

import std.stdio;
shared class test {
    static void sharedTemplate(T)(T arg){
        writeln(arg);
    }
}
void main(){
    test.sharedTemplate(5);
}

Produces:

src\main.d(10): Error: template main.test.sharedTemplate does not match any
function template declaration. Candidates are:
src\main.d(4):        main.test.sharedTemplate(T)(T arg)
src\main.d(10): Error: template main.test.sharedTemplate(T)(T arg) cannot
deduce template function from argument types !()(int)

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


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
                 CC|                            |andrej.mitrovich gmail.com,
                   |                            |k.hara.pg gmail.com
           Platform|x86_64                      |All
         OS/Version|Windows                     |All


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-03-12
14:16:06 PDT ---
This is fixed in git-head, but I don't know if it's a duplicate report. Maybe
kenji knows.

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