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

--- Comment #0 from Jonathan M Davis <> 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,
                         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:
------- You are receiving this mail because: -------

Reply via email to