From: Alex Rousskov Date: Sat, 12 Mar 2016 18:40:29 +0000 (-0700) Subject: Trying to avoid "looser throw specifier" error with Wheezy GCC. X-Git-Tag: SQUID_4_0_8~36 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=87ae5947b025bbc5a8f6fff81a81128db1293455;p=thirdparty%2Fsquid.git Trying to avoid "looser throw specifier" error with Wheezy GCC. AFAICT, the default CbdataParent destructor gets implicit "noexcept(true)" specifier (because the default destructor does not throw itself, and CbdataParent has no data members or parents that could have contributed potentially throwing destructors). The AsyncJob child uses a lot of things that might throw during destruction (the compiler cannot tell for sure because we do not use noexcept specifiers). Thus, the compiler has to use "noexcept(false)" specifier for ~AsyncJob, which is "looser" that "noexcept(true)" for ~CbdataParent and, hence, violates the parent interface AsyncJob is implementing/overriding. I have doubts about the above analysis because many other compilers, including GCC v5 and clang are happy with the default virtual CbdataParent destructor. If my analysis is correct, then the rule of thumb is: Base classes must not use "= default" destructors until all our implicit destructors become "noexcept". --- diff --git a/src/cbdata.h b/src/cbdata.h index 5b815a82ad..e91c621d51 100644 --- a/src/cbdata.h +++ b/src/cbdata.h @@ -292,7 +292,7 @@ cbdata_type cbdataInternalAddType(cbdata_type type, const char *label, int size) class CbdataParent { public: - virtual ~CbdataParent() = default; + virtual ~CbdataParent() {} virtual void *toCbdata() = 0; };