This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/51431] New: [4.5/4.6/4.7 Regression] ICE with invalid use of abstract class
- From: "reichelt at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 06 Dec 2011 00:44:26 +0000
- Subject: [Bug c++/51431] New: [4.5/4.6/4.7 Regression] ICE with invalid use of abstract class
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51431
Bug #: 51431
Summary: [4.5/4.6/4.7 Regression] ICE with invalid use of
abstract class
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: reichelt@gcc.gnu.org
The following invalid code snippet triggers an ICE since GCC 4.4.0:
===================================
struct A
{
virtual void foo() = 0;
};
struct B
{
A a;
B() : a() {}
};
===================================
bug.cc:8:5: error: cannot declare field 'B::a' to be of abstract type 'A'
bug.cc:1:8: note: because the following virtual functions are pure within
'A':
bug.cc:3:16: note: virtual void A::foo()
bug.cc: In constructor 'B::B()':
bug.cc:9:11: error: cannot allocate an object of abstract type 'A'
bug.cc:1:8: note: since type 'A' has pure virtual functions
bug.cc:9:11: internal compiler error: tree check: expected aggr_init_expr, have
error_mark in build_value_init, at cp/init.c:365
Please submit a full bug report, [etc.]