[Issue 10500] New: Problem with length property when using variant

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jun 29 04:04:58 PDT 2013


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 at puremagic.com
        ReportedBy: develop32 at gmail.com


--- Comment #0 from Justinas Šneideris <develop32 at gmail.com> 2013-06-29 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: -------


More information about the Digitalmars-d-bugs mailing list