Bug 39153 - virtual default dtor not defined
Summary: virtual default dtor not defined
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: ---
Assignee: Jason Merrill
URL:
Keywords: documentation
: 39158 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-02-11 19:53 UTC by Benjamin Kosnik
Modified: 2009-02-12 02:12 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-02-11 21:56:21


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Kosnik 2009-02-11 19:53:07 UTC
Compiling:

struct _Impl_base
{
  _Impl_base() = default;
  virtual ~_Impl_base() = default;
};

template<typename _Tp>
class _Impl : public _Impl_base
{ };

int main()
{
  _Impl<int> i;
  return 0;
}


Gives:
gcc version 4.4.0 20090208 (experimental) (GCC) 

%COMP.sh "-g -O0 -std=c++0x -fno-inline" vague_vs_default.cc
vague_vs_default.cc:4: warning: inline function ‘virtual _Impl_base::~_Impl_base()’ used but never defined
vague_vs_default.cc:4: warning: inline function ‘virtual _Impl_base::~_Impl_base()’ used but never defined

Which seems strange, as the base destructor is defined as default.

Also, the vauge linkage/vtable documentation bits here
http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118

may need to be updated or expanded to take into account defaulted destructors vs. key method vtable emission.
Comment 1 Benjamin Kosnik 2009-02-11 22:13:50 UTC
*** Bug 39158 has been marked as a duplicate of this bug. ***
Comment 2 Jason Merrill 2009-02-12 02:01:28 UTC
Subject: Bug 39153

Author: jason
Date: Thu Feb 12 02:01:07 2009
New Revision: 144119

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=144119
Log:
        PR c++/39153
        * decl2.c (cp_write_global_declarations):
        Check DECL_DEFAULTED_FN, not DECL_ARTIFICIAL.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/defaulted9.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl2.c
    trunk/gcc/testsuite/ChangeLog

Comment 3 Jason Merrill 2009-02-12 02:12:12 UTC
Fixed.