https://issues.dlang.org/show_bug.cgi?id=14784
Issue ID: 14784 Summary: Variant and Proxy don't get along Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: phobos Assignee: nob...@puremagic.com Reporter: r...@rcorre.net Created attachment 1530 --> https://issues.dlang.org/attachment.cgi?id=1530&action=edit 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). --