[Issue 8560] New: Strange behavior of lambda expressions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Aug 18 13:45:46 PDT 2012


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

           Summary: Strange behavior of lambda expressions
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: iu.biryukov at gmail.com


--- Comment #0 from ilya <iu.biryukov at gmail.com> 2012-08-18 13:45:45 PDT ---
I came up with this code while playing around with D:

import std.stdio;

public class Test(alias fun, alias fun2) {
  void doIt() {
    fun();
    fun2();
  }
}


void main() {
  (new Test!(
      () => {writeln("fun1");},
      () => writeln("fun2")
    )
  ).doIt();
}

After compiling this code I expect to see the following output(or compiler
error, if I'm misusing lambda syntax):
fun1
fun2

Insted I get:
fun2

DMD64 D Compiler v2.060

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