[Issue 5695] New: Problem with TypeTuple of lambdas

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 4 05:14:05 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5695

           Summary: Problem with TypeTuple of lambdas
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2011-03-04 05:11:10 PST ---
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

-- 
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