This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/65615] New: gcc says abstract class even though it isn't
- From: "gartenriese at gulli dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 27 Mar 2015 23:32:28 +0000
- Subject: [Bug c++/65615] New: gcc says abstract class even though it isn't
- Auto-submitted: auto-generated
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.