[Issue 11169] New: cannot create instance of abstract class

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 3 22:19:23 PDT 2013


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

           Summary: cannot create instance of abstract class
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: pycerl at qq.com


--- Comment #0 from Zhouxuan <pycerl at qq.com> 2013-10-03 22:19:23 PDT ---
////////////////////////////////////////////////////////////
//case 1

class A
{
    abstract void foo();
}

class B : A
{
    static if( __traits(isAbstractClass, typeof(this) ))
    {
    }

    override void foo()
    {
    }
}

void main()
{
    B b = new B();
}

//Error: cannot create instance of abstract class B
////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////
//case 2

abstract class A
{
    void foo();
}

class B : A
{
    static if( __traits(isAbstractClass, typeof(this) ))
    {
    }

    override void foo()
    {
    }
}

void main()
{
    B b = new B();
}

//Okay
////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////
//case 3

class A
{
    abstract void foo();
}

class B : A
{
    override void foo()
    {
    }
}

void main()
{
    B b = new B();
}

//Okay
////////////////////////////////////////////////////////////

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