Fix catch-value warning
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Tue, 30 Dec 2025 09:10:07 +0000 (10:10 +0100)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Wed, 31 Dec 2025 11:11:25 +0000 (12:11 +0100)
Original warning:
src/pointer_func.hpp:74:27: error: catching polymorphic type 'class boost::bad_weak_ptr' by value [-Werror=catch-value=]

Changed both catch statements to catch by reference (const&) instead of by value.

src/pointer_func.hpp

index dde564b..8251020 100644 (file)
@@ -71,7 +71,7 @@ class SharedBase
             try {
                 result = shared_from_this();
             }
-            catch (boost::bad_weak_ptr)
+            catch (const boost::bad_weak_ptr&)
             {
             }
             return result;
@@ -94,7 +94,7 @@ class SharedBase
             try {
                 ptr = shared_from_this();
             }
-            catch (boost::bad_weak_ptr)
+            catch (const boost::bad_weak_ptr&)
             {
             }
             if (ptr)