[Issue 6506] OS X: wrong value is passed to simple argument along with a delegate with -O

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 16 11:50:33 PDT 2011


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


kennytm at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|OS X: wrong value is passed |OS X: wrong value is passed
                   |to simple argument with a   |to simple argument along
                   |lazy parameter with         |with a delegate with -O
                   |-unittest -release -O       |


--- Comment #1 from kennytm at gmail.com 2011-08-16 11:50:31 PDT ---
Correction:

1. Only -O is needed.
2. It's not 'lazy' causing the bug, but passing a nested delegate.

-------------------------------
void enforce6506b(bool condition, void delegate() m) {
    assert(!condition);
}
void toImpl6506b(int value) {
    void f(){}
    enforce6506b(value >= 0, &f);
}
void bug6506b() {
    toImpl6506b(-112345);
}

void main() { bug6506b(); }
-------------------------------
$ dmd -O z.d
$ ./z
core.exception.AssertError at z(2): Assertion failure
...
-------------------------------

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