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++/25826] New: "pure virtual" destructors accepted by GCC, but cause link failure


The following code:

class A
   {
   public:
      virtual ~A() = 0;
   };

class B : public A
   {
   public:
      ~B() {}
   };

int main()
   {
   B b;
   }

compiles with GCC 4.0.2 (clean with -ansi -Wall -Wextra) but does not link due
to an undefined reference to ~A(). Herb Sutter claims this code is valid, for
whatever that might be worth (http://www.gotw.ca/gotw/031.htm), but in either
case this seems to be a bug; either it should be rejected with a diagnostic as
invalid code, or it should link (and ideally do something sensible).


-- 
           Summary: "pure virtual" destructors accepted by GCC, but cause
                    link failure
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: lloyd at randombit dot net
 GCC build triplet: i386-redhat-linux
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25826


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