[Issue 3922] Wrong error message with return in void function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 8 11:33:36 PDT 2011


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



--- Comment #5 from kennytm at gmail.com 2011-06-08 11:29:02 PDT ---
... indeed it is.


// ReturnStatement::semantic

    if (exp && tbret->ty == Tvoid && !implicit0)
    {
        /* Replace:
         *      return exp;
         * with:
         *      exp; return;
         */
        Statement *s = new ExpStatement(loc, exp);
        exp = NULL;
        s = s->semantic(sc);
        return new CompoundStatement(loc, s, this);
    }

Perhaps there should be a check in 'exp' here to ensure its type is 'void'.

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