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]

[C++ Patch] PR 57645


Hi,

when I implemented Core/1123 "Destructors should be noexcept by default", unfortunately I caused this regression, present now in mainline and 4_8-branch.

When the destructor is user provided, with no exception specifications, and the type has data members (not bases, those are already Ok) with the destructor which can throw, the destructor is wrongly deduced to be noexcept. The reason is that deduce_noexcept_on_destructors is called from check_bases_and_members after check_bases but *before* check_methods and therefore the latter does too late work relevant for the deduction, namely possibly setting TYPE_HAS_NONTRIVIAL_DESTRUCTOR.

My proposal for a fix involves simply anticipating that work as part of deduce_noexcept_on_destructors, renamed now check_destructors, and called unconditionally. Things appear to work fine. Of course different refactorings and naming schemes could make perfect sense.

Tested x86_64-linux.

Thanks,
Paolo.

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

Attachment: CL_57645
Description: Text document

Attachment: patch_57645
Description: Text document


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