Summary: std.variant Variant's check for "can append" is wrong
           Product: D
           Version: 2.023
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos

The code below used in std.variant seems to be assuming that if a type can be
indexed, then it can also be appended to:
        case OpID.catAssign:
            auto me = cast(A*) pStore;
            static if (is(typeof((*me)[0])) && !is(typeof(me.keys)))
                // array type; parm is the element to append
                auto arg = cast(VariantN*) parm;
                alias typeof((*me)[0]) E;
                if (arg[0].convertsTo!(E))
                    // append one element to the array
                    (*me) ~= [ arg[0].get!(E) ];
                    // append a whole array to the array
                    (*me) ~= arg[0].get!(A);

This causes it to fail when trying to use a fixed-length struct, like a fixed
vec3 that provides an opIndex but no opCatAssign.


Reply via email to