Hi,
we reject, with a "different exception specifier" error, both:

template<typename T>
struct A
{
  ~A() noexcept;
};

template<typename T>
A<T>::~A() { }

and:

template<typename T>
struct A
{
  ~A();
};

template<typename T>
A<T>::~A() noexcept { }

Over the last days I wasted a lot of time trying painfully to not reject either, but actually now I'm pretty sure that we are right to reject the former (there are exception specifiers on the declaration thus automatic deduction should not trigger at all) and probably also the latter.

I'm OK with that, as long as we correctly allow

struct B
{
  ~B() noexcept;
};

B::~B() { }

and

struct B
{
  ~B();
};
B::~B() noexcept { }
Agreed. Thanks for asking on the reflector.

The patch is OK.
Thanks again, the patch is in with the attached ChangeLog.

Paolo.

////////////////////////
/cp
2012-04-01  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/50043
        * class.c (deduce_noexcept_on_destructor,
        deduce_noexcept_on_destructors): New.
        (check_bases_and_members): Call the latter.
        * decl.c (grokfndecl): Call the former.
        * method.c (implicitly_declare_fn): Not static.
        * cp-tree.h (deduce_noexcept_on_destructor, implicitly_declare_fn):
        Declare

/testsuite
2012-04-01  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/50043
        * g++.dg/cpp0x/noexcept17.C: New.
        * g++.old-deja/g++.eh/cleanup1.C: Adjust.
        * g++.dg/tree-ssa/ehcleanup-1.C: Likewise.
        * g++.dg/cpp0x/noexcept01.C: Likewise.
        * g++.dg/eh/init-temp1.C: Likewise.
        * g++.dg/eh/ctor1.C: Likwise.

Reply via email to