[Issue 21021] std.variant confused by alias this when struct larger than maxDataSize

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 7 07:33:52 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=21021

Simen Kjaeraas <simen.kjaras at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simen.kjaras at gmail.com
           Hardware|x86                         |All
            Summary|sending a struct containing |std.variant confused by
                   |array using send/receive    |alias this when struct
                   |have problems.              |larger than maxDataSize
                 OS|Mac OS X                    |All
           Severity|enhancement                 |major

--- Comment #3 from Simen Kjaeraas <simen.kjaras at gmail.com> ---
Reduced:

import std.variant;

struct Message {
        int h;
        int[5] array;
        alias h this;
}

unittest {
    Message msg;
    msg.array[] = 3;
    Variant a = msg;
    auto other = a.get!Message;
    assert(msg.array[0] == 3);
    assert(other.array[0] == 3);
}

Change Variant to VariantN!40, or reduce the size of Message to maxDataSize or
below, and it works.

--


More information about the Digitalmars-d-bugs mailing list