On Saturday, 9 April 2022 at 10:39:33 UTC, vit wrote:
Why doesn't this code compile?
`proxySwap1` is lying about its attributes. It says `rhs` is
`scope`, but it escapes by assignment `this.ptr = rhs.ptr;`. The
compiler doesn't raise an error because it's marked `@trusted`.
`proxySwap2` is
Hello,
Why doesn't this code compile?
```d
static struct Foo{
void *ptr;
void proxySwap1(scope ref typeof(this) rhs)scope pure nothrow
@trusted @nogc{
auto tmp = this.ptr;
this.ptr = rhs.ptr;
rhs.ptr = tmp;
}
void proxySwap2()(scope ref typeof(this) rh