This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/65615] New: gcc says abstract class even though it isn't


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65615

            Bug ID: 65615
           Summary: gcc says abstract class even though it isn't
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gartenriese at gulli dot com

The following does not compile with gcc 4.9.2

class O {};

class D : public virtual O {
public:
    virtual float foo() const = 0;
};

class B : public D {
public:
    B(float, float) {}
};

class R : public B {
public:
    R() : B{1.f, 1.f} {}
    virtual float foo() const override { return 0.f; }
};

int main() {
    R r;
}

It says it cannot instantiate an object of abstract class B.
With Clang 3.6 it compiles.
See discussion here:
http://stackoverflow.com/questions/29289857/base-class-with-pure-virtual-functions

If I use () instead of {} to create B, it compiles.
If B has only one parameter in the constructor instead of two, it compiles.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]