[Issue 5399] New: Return the result of a nonvoid function in a void function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jan 1 13:52:06 PST 2011


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

           Summary: Return the result of a nonvoid function in a void
                    function
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          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-01-01 13:49:57 PST ---
In D (rightly) you can't return a value different from void inside a void
function. But this code compiles and runs with no errors in DMD 2.051 (bug
found by Daren Scot Wilson):


int foo() { return 1; }
void main() {
    return foo();
}

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