[Issue 13339] Address of parameter wrong in out contract

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Aug 20 07:21:27 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13339

--- Comment #5 from Tim <tim.dlang at t-online.de> ---
(In reply to Iain Buclaw from comment #1)
> 2) When calling in/out contracts, the parameters of the body function should
> be passed directly.
> 
> void test(B this, size_t i, A a)
> {
>   // body...
>   test.out(this, i, a);
> }
> 
> void test.out(void *this, size_t i, A a)
> {
>   // Takes address of &a ...
> }

This would probably not work, if i is changed in the delegate:

void test(size_t i, A a)
out
{
    writeln(i);
}
body
{
    void delegate() dg = {i++;};
    dg();
}

--


More information about the Digitalmars-d-bugs mailing list