Bug 15499 – IFTI fails with function literal alias

Status
NEW
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-01-02T11:37:17Z
Last change time
2024-12-13T18:46:13Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
Daniel
See also
https://issues.dlang.org/show_bug.cgi?id=18037
Moved to GitHub: dmd#19081 →

Comments

Comment #0 by wyrlon — 2016-01-02T11:37:17Z
alias add1(T1,T2) = (T1 a, T2 b) => a+b; int add2(T1,T2) (T1 a, T2 b) { return a+b; } void main() { import std.stdio; add1(1,1).writeln; // cannot deduce function from argument types !()(int, int) add2(1,1).writeln; // OK }
Comment #1 by b2.temp — 2016-01-02T14:32:16Z
(In reply to Daniel from comment #0) > alias add1(T1,T2) = (T1 a, T2 b) => a+b; > int add2(T1,T2) (T1 a, T2 b) { return a+b; } > > void main() > { > import std.stdio; > add1(1,1).writeln; // cannot deduce function from argument types !()(int, > int) > add2(1,1).writeln; // OK > } It's maybe a dup of 1807. I asked this a while ago on the forum (IFTI failed in partial template specialization). http://forum.dlang.org/post/[email protected] => https://issues.dlang.org/show_bug.cgi?id=1807
Comment #2 by nick — 2023-08-26T11:38:03Z
> alias add1(T1,T2) = (T1 a, T2 b) => a+b; > int add2(T1,T2) (T1 a, T2 b) { return a+b; } I think this should be changed to an enhancement, because add1 is a function literal template, whereas add2 is a function template. A function literal is a pointer, a function is not.
Comment #3 by robert.schadek — 2024-12-13T18:46:13Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19081 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB