[Issue 5884] New: Cannot use function named 'init' with class subtyping

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Apr 24 15:14:06 PDT 2011


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

           Summary: Cannot use function named 'init' with class subtyping
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2011-04-24 15:10:26 PDT ---
class Foo
{
    public:
    void savestate() { }
    void loadstate(void*) { }    
    void init2(void*) { }
    void init(void*) { }
}

class Bar
{
    private Foo _foo;
    alias _foo this;

    this()
    {
        _foo = new Foo;
    }
}

void main()
{
    auto b = new Bar;

    b.savestate();      // ok
    b.loadstate(null);  // ok
    b.init2(null);      // ok
    b.init(null);       // Error: no property 'opCall' for type 'test.Foo'
}

It's a blocker for me because I have a COM interface with a method called
"init", and I'm unable to use subtyping in a class that holds a COM object due
to this weird bug.

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