← Back to index
|
Original Bugzilla link
Bug 15827 – std.variant.Variant can not be initialized with some struct
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-03-24T14:40:00Z
Last change time
2016-03-30T17:15:24Z
Assigned to
nobody
Creator
maximzms
Comments
Comment #0
by maximzms — 2016-03-24T14:40:39Z
Test: -------------------- import std.variant; struct Foo { Variant v; this(Foo v) {} } void main() { Variant v = Foo.init; } -------------------- Output: -------------------- ../import/std/variant.d(571): Error: variable std.variant.VariantN!32LU.VariantN.opAssign!(Foo).opAssign.rhs has scoped destruction, cannot build closure -------------------- The error message is referring to line [std.variant:571] but is triggered by line [std.variant:615]. Foo must have both member of type Variant and constructor accepting Foo in order to produce the error. It seems to be related to Issue 5730. [std.variant:571]:
https://github.com/D-Programming-Language/phobos/blob/708c5d8e6ddd9245f793e4b8761382672225f271/std/variant.d#L571
[std.variant:615]:
https://github.com/D-Programming-Language/phobos/blob/708c5d8e6ddd9245f793e4b8761382672225f271/std/variant.d#L615
[Issue 5730]:
https://issues.dlang.org/show_bug.cgi?id=5730
Comment #1
by maximzms — 2016-03-24T14:46:53Z
https://github.com/D-Programming-Language/phobos/pull/4118
Comment #2
by github-bugzilla — 2016-03-30T17:15:24Z
Commits pushed to master at
https://github.com/D-Programming-Language/phobos
https://github.com/D-Programming-Language/phobos/commit/f9aa6f6efc503aacf704dbd677f63b29e37cb63e
Fix Issue 15827. Avoid explicit use of parameter in delegate.
https://github.com/D-Programming-Language/phobos/commit/2f5a8bb99cc821e69c9fbf9d2d4f5f63c76179a4
Merge pull request #4118 from MaksimZh/fix-15827 Fix Issue 15827 - std.variant.Variant can not be initialized with some struct