[Issue 5753] New: Disallow map() of void function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 19 07:14:17 PDT 2011


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

           Summary: Disallow map() of void function
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2011-03-19 07:11:03 PDT ---
This code compiles with no errors (DMD 2.052), but in my opinion it has to
raise a compile-time error, because map() must statically refuse functions that
return void:


import std.algorithm;
void foo() {}
void main() {
    int[] data = [1, 2, 3];
    map!((int i){ return foo(); })(data);
}

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