[Issue 8195] New: Segfault when comparing a VariantN to a non-variant type which it holds

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 3 21:52:59 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8195

           Summary: Segfault when comparing a VariantN to a non-variant
                    type which it holds
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: jmdavisProg at gmx.com


--- Comment #0 from Jonathan M Davis <jmdavisProg at gmx.com> 2012-06-03 21:54:52 PDT ---
This code:

import std.typetuple;
import std.variant;


struct S
{
    int a;
    long b;
    string c;
    real d;
    bool e;
}

private alias TypeTuple!(string,
                         int,
                         S) Types;


alias VariantN!(maxSize!Types, Types) MyVariant;

void main()
{
    auto v = MyVariant(S.init);
    assert(v == S.init);
}


segfaults when it's run. If you change the assertion to

    assert(v == MyVariant(S.init));

then it runs just fine. This appears to only happen when a struct whose size is
>= Variant.sizeof is in the list of accepted types.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list