Thread overview
[Issue 10223] Variant[] within Variant[] can be accessed, but not assigned to
Jun 10, 2015
Wyatt
Dec 28, 2019
berni44
Dec 17, 2022
Iain Buclaw
June 10, 2015
https://issues.dlang.org/show_bug.cgi?id=10223

--- Comment #1 from Wyatt <wyatt.epp@gmail.com> ---
An NG post reminded me of this, so I just tested it on 2.067.1 and the output is rather different:

wyatt@Yue ~/tmp/d $ rdmd ./issue10223.d
bar
Segmentation fault
wyatt@Yue ~/tmp/d $

Okay, so it compiles now, but still doesn't work.  We don't get nice things on Linux, so I tried it on my Windows workstation over lunch and found it's just been turned from a disappointment at compile time to a knife in the back at runtime:

[0s] jwe29@PC91534 ~/tmp $ rdmd ./issue10223.d
object.Error@(0): Access Violation
----------------
0x0042B626
0x00405141
0x00404667
0x004073D2
0x004021B1
0x0040B5E6
0x0040B5BB
0x0040B4D3
0x0040750B
0x7480337A in BaseThreadInitThunk
0x76F28FE2 in RtlInitializeExceptionChain
0x76F28FB5 in RtlInitializeExceptionChain
=== Bypassed ===
std.variant.VariantException@std\variant.d(1445): Variant: attempting to use
incompatible types immutable(char)[] and std.variant.VariantN!20u.VariantN
----------------
0x004050E6
0x00404667
0x004073D2
0x004021B1
0x0040B5E6
0x0040B5BB
0x0040B4D3
0x0040750B
0x7480337A in BaseThreadInitThunk
0x76F28FE2 in RtlInitializeExceptionChain
0x76F28FB5 in RtlInitializeExceptionChain
object.Error@(0): Access Violation
----------------
0x0042B626
0x00405141
0x00404667
0x004073D2
0x004021B1
0x0040B5E6
0x0040B5BB
0x0040B4D3
0x0040750B
0x7480337A in BaseThreadInitThunk
0x76F28FE2 in RtlInitializeExceptionChain
0x76F28FB5 in RtlInitializeExceptionChain
=== ~Bypassed ===
bar
[2s] jwe29@PC91534 ~/tmp $

--
December 28, 2019
https://issues.dlang.org/show_bug.cgi?id=10223

berni44 <bugzilla@d-ecke.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@d-ecke.de

--- Comment #2 from berni44 <bugzilla@d-ecke.de> ---
I tried to hunt the bug down, but did only succeed partially. I'll write here, what I could find out. Maybe this is of some help for someone else:

* The crash happens inside of the @trusted part of the destructor of VariantN.

* When top[0][0] = "foo" is executed, opAssign is called twice, first with parameter "foo" and second with parameter 0, which is the value of the second bracket. Feels a little bit like this 0 is the wrong thing to assign here, but I'm not sure.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=10223

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P3

--
December 01
https://issues.dlang.org/show_bug.cgi?id=10223

--- Comment #3 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/phobos/issues/9980

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--