Bug 56343 - [4.8 regression] [C++11] Destructor defaulted on first declaration has wrong implicit exception specification
Summary: [4.8 regression] [C++11] Destructor defaulted on first declaration has wrong ...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: 4.8.0
Assignee: Jason Merrill
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2013-02-15 14:35 UTC by Jonathan Wakely
Modified: 2013-02-15 18:00 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2013-02-15 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Wakely 2013-02-15 14:35:45 UTC
Trunk rejects this:

class B
{
public:
  virtual ~B() noexcept(false) { }
};

class D : public B
{
public:
  virtual ~D() = default;
};

t.cc:10:11: error: function 'virtual D::~D()' defaulted on its first declaration with an exception-specification that differs from the implicit declaration 'D::~D()'
   virtual ~D() = default;
           ^

[class.dtor]/3 "A declaration of a destructor that does not have an exception-specification is implicitly considered to have the same exception-specification as an implicit declaration (15.4)."

[dcl.fct.def.default]/2 "If a function is explicitly defaulted on its first declaration [...] it is implicitly considered to have the same exception-specification as if it had been implicitly declared (15.4)."


Possibly related to PR 53903
Comment 1 Jason Merrill 2013-02-15 17:19:56 UTC
Author: jason
Date: Fri Feb 15 17:19:45 2013
New Revision: 196082

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196082
Log:
	PR c++/56343
	* class.c (check_bases_and_members): Deduce noexcept after
	checking bases.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/defaulted41.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/class.c
Comment 2 Jason Merrill 2013-02-15 18:00:10 UTC
Fixed.