Bug 13484 – Template type deduction from delegate parameter fails
Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-09-16T16:26:00Z
Last change time
2015-02-18T03:37:05Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
weltensturm
Comments
Comment #0 by weltensturm — 2014-09-16T16:26:08Z
When overloading a template function taking a delegate with type T with one lacking arguments, type deduction fails:
test.d(10): Error: template test.test cannot deduce function from argument types !()(void function(float _param_0) pure nothrow @nogc @safe), candidates are:
test.d(2): test.test()(void delegate() hi)
test.d(5): test.test(T)(void delegate(T) hi)
Minimal example:
void test()(void delegate() hi){
}
void test(T)(void delegate(T) hi){
}
void main(){
test({}); // works
test((float){}); // throws error
}
Expected:
No error, correct deduction
DMD version:
DMD64 D Compiler v2.066