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

            Bug ID: 88114
           Summary: "virtual ~destructor() = default": Destructor not
                    created
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

Created attachment 45045
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45045&action=edit
Test case (test.tar.gz with test.h test.cc test2.h test3.cc); use: g++
-std=c++11 test.cc test3.cc

That's with current GCC 7, 8 and 9.
It works with Clang++ 5.0


# g++ -std=c++11 test.cc test3.cc

/tmp/ccEAjdJa.o: In function `Two::~Two()':
test3.cc:(.text._ZN3TwoD2Ev[_ZN3TwoD5Ev]+0x30): undefined reference to
`One::~One()'


That's with using
  #pragma interface       (in test.h)
and
  #pragma implementation  (in test.cc)

The destructor One::~One() is supposed to get created when compiling "test.cc".

The symbol *is* generated *unless* both of the following
* virtual ~One = default;  // Using 'inline virtual ~One() {}' works
* There is (at least one) 'virtual ... = 0' function

Reply via email to