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++/51431] New: [4.5/4.6/4.7 Regression] ICE with invalid use of abstract class


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


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