Bug 9707 – Template argument deduction does not work with static methods of shared class
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-03-12T12:04:37Z
Last change time
2019-08-18T23:22:31Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
Robert Luger
Comments
Comment #0 by weltensturm — 2013-03-12T12:04:37Z
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)
Comment #1 by andrej.mitrovich — 2013-03-12T14:16:06Z
This is fixed in git-head, but I don't know if it's a duplicate report. Maybe kenji knows.
Comment #2 by ag0aep6g — 2019-08-18T23:22:23Z
(In reply to Andrej Mitrovic from comment #1)
> This is fixed in git-head, but I don't know if it's a duplicate report.
> Maybe kenji knows.
That was six years ago. Closing as worksforme.