www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5695] New: Problem with TypeTuple of lambdas

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc



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: -------
Mar 04 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5695




With 2.058head (f8887855), that code works correctly.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 26 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5695


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 26 2012