]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Trying to avoid "looser throw specifier" error with Wheezy GCC.
authorAlex Rousskov <rousskov@measurement-factory.com>
Sat, 12 Mar 2016 18:40:29 +0000 (11:40 -0700)
committerAlex Rousskov <rousskov@measurement-factory.com>
Sat, 12 Mar 2016 18:40:29 +0000 (11:40 -0700)
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".

src/cbdata.h

index 5b815a82ad0d33dc8ac2ccef119a1135bf8738a9..e91c621d5116a8e91a22c91c032c504ba654c2de 100644 (file)
@@ -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;
 };