[Issue 4825] Regression(1.057, 2.040) "Error: non-constant expression" with -inline

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Sep 27 13:26:49 PDT 2010


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


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #3 from Don <clugdbug at yahoo.com.au> 2010-09-27 13:26:04 PDT ---
This was caused by the improvements to CommaExp::interpret, making things like
(int x=3, x); into an lvalue, which allows struct constructors to work in CTFE.
But inlining can also create peculiar comma expressions. We need to make sure
that non-ref returns return rvalues, not lvalues.

PATCH interpret.c, ReturnStatement::interpret(), line 566.
--- old ----
#if LOG
    Expression *e = exp->interpret(istate);
    printf("e = %p\n", e);
    return e;
#else
    return exp->interpret(istate);
#endif
--- new ---
    Expression *e = exp->interpret(istate);
    if (e == EXP_CANT_INTERPRET)
        return e;
    // Convert lvalues into rvalues
    if (e->op == TOKvar)
        e = e->interpret(istate);
    return e;

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