This is the mail archive of the gcc-patches@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]

Re: [C++ RFC / Patch] Implementing "Deducing "noexcept" for destructors"


Hi again,

On 03/30/2012 12:26 AM, Paolo Carlini wrote:
On 03/29/2012 09:27 PM, Jason Merrill wrote:
On 03/29/2012 03:06 PM, Paolo Carlini wrote:
The exception specification on old_decl doesn't matter; we can drop
that test.
I seem to remember something going wrong with templates otherwise,
because implicitly_declare_fn has gcc_assert (!dependent_type_p (type));

We shouldn't be doing this for templates anyway, as in general we can't know what the implicitly declared function will look like.
Oh my, as simple as the below appears to work!

I simply added a !processing_template_decl check. Then I removed the deduce_noexcept_on_destructor calls in register_specialization and when I found a proper place in grokfndecl (must be before check_explicit_specialization) I noticed that apparently I can remove the other deduce_noexcept_on_destructor call which I had later on in grokfndecl. Thus the below passes the (updated) testsuite on x86_64-linux.
Sorry for essentially self-replying, but today, while I was traveling, I reviewed in my mind your comments over the last days, and I think I had a buglet in the patch which I sent in the last message: it doesn't make sure, in grokfndecl, to *not* call deduce_noexcept_on_destructor on a destructor of a class still being defined. Thus I'm adding a !TYPE_BEING_DEFINED (DECL_CONTEXT (decl)) check and the complete patch (which I'm attaching below) still passes testing. I also double checked that, for a simple case like:

struct A
{
  ~A();
};

A::~A() { }

we process the declaration from check_bases_and_members and then the definition from grokfndecl.

Thanks,
Paolo.

////////////////////////

Attachment: patch_50043_draft_3
Description: Text document


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