Bug 5695 – Problem with TypeTuple of lambdas

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2011-03-04T05:11:00Z
Last change time
2012-01-26T09:46:16Z
Keywords
wrong-code
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2011-03-04T05:11:10Z
I don't understand what's happening here, but there is a problem somewhere (maybe in this code), D2 code: import std.stdio, std.typetuple; alias TypeTuple!((double x){ return x + x; }, (double x){ return x * x; }) funcs1; double foo1(double x) { return x + x; } double foo2(double x) { return x * x; } alias TypeTuple!(foo1, foo2) funcs2; void main() { enum double x = 5.0; foreach (f; funcs1) writeln(f(x)); foreach (f; funcs2) writeln(f(x)); } It prints (DMD 2.052): 5.28268e-308 0 10 25 Instead of: 10 25 10 25
Comment #1 by k.hara.pg — 2012-01-26T05:05:10Z
With 2.058head (f8887855), that code works correctly.