www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2641] New: std.variant Variant's check for "can append" is wrong

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2641

           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
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: wbaxter gmail.com


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) ];
                }
                else
                {
                    // 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.


-- 
Feb 01 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2641


andrei metalanguage.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED




-- 
Feb 01 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2641


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED




--- Comment #1 from Andrei Alexandrescu <andrei metalanguage.com>  2009-07-07
10:06:58 PDT ---
Fixed in future 2.032 (and checked in for the impatient).

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