lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] PATCH: use std::uncaught_exceptions()


From: Vadim Zeitlin
Subject: Re: [lmi] PATCH: use std::uncaught_exceptions()
Date: Tue, 27 Mar 2018 16:30:57 +0200

On Tue, 27 Mar 2018 11:04:08 +0000 Greg Chicares <address@hidden> wrote:

GC> However, if I apply your patch with further modifications, thus:
[...]
GC> ...then it doesn't seem to do what we hope.

 I didn't have time to test this yet (I'm having too much fun with
gcc/Debian/Universe-as-we-know-it/my-sanity bug), but I think I know why
does this happen: the pages are destroyed from the defaulted dtor of
pdf_illustration, so even though throwing from numbered_page dtor doesn't
terminate the program due to the presence of noexcept(false) there, it's
still getting terminated when the exception excepts pdf_illustration dtor
which is noexcept(true) by default. The fix should be to just replace

    virtual ~pdf_illustration() = default;

with

    virtual ~pdf_illustration() noexcept(false) {}

GC> Is this a gcc defect?

 I don't think so, I had tested that noexcept(false) on dtor prevents
std::terminate() from being called before and it worked with all of gcc (a
few different versions), clang and MSVC.

 Regards,
VZ


reply via email to

[Prev in Thread] Current Thread [Next in Thread]