www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10500] New: Problem with length property when using variant

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

           Summary: Problem with length property when using variant
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: develop32 gmail.com



04:04:57 PDT ---
void main()
{
    struct Vector
    {
        float length();
    }

    import std.variant;
    Variant v = Vector();
}

Currently this does not work, as it seems Variant thinks length() 
is a property restricted to arrays.

"cannot implicitly convert expression ((*zis).length()) of type 
float to int    C:\D\dmd2\src\phobos\std\variant.d    488"

I quickly changed that line in variant.do to "static if 
(is(typeof(zis.length)) && is(ReturnType!(zis.length) == 
size_t))" and my code compiles.

Currently its a hack, but should it be more developed and would 
it not interfere with something else?

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