[Issue 8144] New: Lambda template instantiation at Tuple creation point
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu May 24 14:50:01 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8144
Summary: Lambda template instantiation at Tuple creation point
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2012-05-24 14:51:45 PDT ---
I don't know if this is supposed to work, but it's handy:
import std.typecons: Tuple;
void main() {
alias int function(int, int) Op;
static void foo(Op o) {}
foo((a, b) => a + b); // OK
alias Tuple!(Op) T;
auto t1 = T((int a, int b) => a + b); // OK
auto t2 = T((a, b) => a + b); // Error
}
DMD 2.060alpha gives:
temp.d(8): Error: template std.typecons.Tuple!(int function(int,
int)).Tuple.__ctor does not match any function template declaration
...\dmd2\src\phobos\std\typecons.d(379): Error: template
std.typecons.Tuple!(int function(int, int)).Tuple.__ctor cannot deduce template
function from argument types !()(void)
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list