[Issue 13339] Address of parameter wrong in out contract
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Aug 20 05:03:36 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13339
Iain Buclaw <ibuclaw at gdcproject.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |contracts
CC| |ibuclaw at gdcproject.org
--- Comment #1 from Iain Buclaw <ibuclaw at gdcproject.org> ---
This is a closure-style bug.
To fix, either:
1) Taking the address of 'a' should trigger
VarDeclaration::checkNestedReference to add it to closureVars.
void test(B this, size_t i, A a)
{
test.closure.a = a;
test.closure.this = this;
// body...
test.out(test.closure);
}
void test.out(void *this)
{
// Takes address of &(this.a) ...
}
or
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 ...
}
--
More information about the Digitalmars-d-bugs
mailing list