Created attachment 1530
Test case for using Variant and Proxy
If a struct forwards access to a member via Proxy, assignment to a Variant fails:
-----
import std.typecons, std.variant;
struct Foo { int f; }
struct Bar {
private Foo foo;
mixin Proxy!foo;
int b;
}
unittest {
Bar b;
Variant v = b;
}
-----
/usr/include/dlang/dmd/std/typecons.d(4432): Error: e2ir: cannot cast this.foo of type Foo to type string
Using `alias this` instead of Proxy alleviates the issue (but I must make foo non-private for alias this, hence my desire to use Proxy).
Comment #1 by dlang-bugzilla — 2015-08-31T12:12:17Z