Bug 14784 – Variant and Proxy don't get along

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2015-07-07T17:43:00Z
Last change time
2015-08-31T12:57:06Z
Assigned to
nobody
Creator
ryan

Attachments

IDFilenameSummaryContent-TypeSize
1530variant_proxy.dTest case for using Variant and Proxytext/x-dsrc159

Comments

Comment #0 by ryan — 2015-07-07T17:43:30Z
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
Comment #2 by ryan — 2015-08-31T12:57:06Z
Confirmed, seems to be fixed.