[Issue 6417] New: Problem with count inside out{} of class method

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 31 08:55:27 PDT 2011


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

           Summary: Problem with count inside out{} of class method
           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-07-31 08:55:25 PDT ---
D2 code:


import core.stdc.stdio: printf;
import std.algorithm: count;
class Foo {
    void bar()
    out {
        int i = 10;
        count!((int k){ printf("%d\n", i); return 1; })([0]);
    } body {}
}
void main() {
    auto f = new Foo();
    f.bar();
}


It prints:
1244668

Instead of:
10

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