Bug 10767 – Regression (2.057): Type inference does not work with a function with a UDT parameter
Status
RESOLVED
Resolution
DUPLICATE
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-08-06T17:02:00Z
Last change time
2013-08-29T03:45:45Z
Assigned to
nobody
Creator
andrej.mitrovich
Comments
Comment #0 by andrej.mitrovich — 2013-08-06T17:02:27Z
-----
struct S { }
void test(F)(F f) { }
void main()
{
test( (int) { } );
test( (S) { } ); // L10
}
-----
2.057:
$ dmd test.d
>
2.058:
$ dmd test.d
> test.d(10): Error: template test.test(F) does not match any function template declaration
> test.d(10): Error: template test.test(F) cannot deduce template function from argument types !()(void)
Comment #1 by andrej.mitrovich — 2013-08-06T17:03:26Z
Btw, I keep forgetting whether the version in the regression title should refer to the last working version, or the first version introducing the bug?
Comment #2 by andrej.mitrovich — 2013-08-06T17:05:34Z
(In reply to comment #0)
> -----
> struct S { }
>
> void test(F)(F f) { }
>
> void main()
> {
> test( (int) { } );
> test( (S) { } ); // L10
> }
> -----
The fix for this is incredible:
void main()
{
test( (S s) { } ); // works
test( (S) { } ); // fails
}
What's going on in the front-end?
Comment #3 by k.hara.pg — 2013-08-06T17:21:36Z
*** This issue has been marked as a duplicate of issue 7198 ***
Comment #4 by yebblies — 2013-08-29T03:45:45Z
(In reply to comment #1)
> Btw, I keep forgetting whether the version in the regression title should refer
> to the last working version, or the first version introducing the bug?
The first version introducing the bug.