[Issue 4916] New: struct VariantN does not overload ()

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Sep 22 20:12:25 PDT 2010


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

           Summary: struct VariantN does not overload ()
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: ah08010-d at yahoo.com


--- Comment #0 from Austin Hastings <ah08010-d at yahoo.com> 2010-09-22 20:11:45 PDT ---
This code:
==============
module scratch;

import std.variant;

unittest {
    Variant v;

    int foo() { return 1; }

    v = &foo;

    v();
}
================
Produces this error:
================
$ dmd -unittest -run bronze/util/scratch.d
bronze\util\scratch.d(12): Error: struct VariantN does not overload ()
===============

IMO, this is a design flaw: Variants claim to support function and delegate
pointers, and it seems obvious that supporting them should support invoking
them. (In particular, since functions and delegates are different sizes,
Variants should be very useful in this role, except ...)

-- 
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