[Issue 5424] New: Cant assign interfaces to Variants

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jan 7 19:47:25 PST 2011


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

           Summary: Cant assign interfaces to Variants
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: mandeep at brars.co.in


--- Comment #0 from Mandeep Singh Brar <mandeep at brars.co.in> 2011-01-07 19:45:07 PST ---
> Hi,
>
> Is it possible to point a Variant to an interface. The below code does not compile.
>
> module testD;
> import std.stream;
> import std.stdio;
> import std.variant;
>
> interface A {
>  void func1();
> }
> class AC: A {
>  void func1() {
>   writeln("func1");
>  }
> }
> int main() {
>  A a = new AC();
>  a.func1();
>  Variant b = Variant(a);
>  return 0;
> }
>
> It says that opEquals is not defined for the interface.
>
> Thanks & Regards
> Mandeep

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