From 34d5e96c19bc65e3f9ab518bc4fce5c24c5b64ca Mon Sep 17 00:00:00 2001 From: Kienan Stewart Date: Tue, 6 Aug 2024 11:14:49 -0400 Subject: [PATCH] Fix: Compilation failure in session_not_found_error with GCC 4.8 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Observed issue ============== When compiling with gcc 4.8.5, the compilation fails with the following erorr: ``` session.hpp:577:2: error: function 'lttng::sessiond::exceptions::session_not_found_error::session_not_found_error(lttng::sessiond::exceptions::session_not_found_error&&)' defaulted on its first declaration with an exception-specification that differs from the implicit declaration 'lttng::sessiond::exceptions::session_not_found_error::session_not_found_error(lttng::sessiond::exceptions::session_not_found_error&&)' session.hpp:577:2: error: function 'lttng::sessiond::exceptions::session_not_found_error::session_not_found_error(lttng::sessiond::exceptions::session_not_found_error&&)' defaulted on its first declaration with an exception-specification that differs from the implicit declaration 'lttng::sessiond::exceptions::session_not_found_error::session_not_found_error(lttng::sessiond::exceptions::session_not_found_error&&)' ``` Cause ===== This is due a bug in GCC which is fixed as of GCC 5.0[1] Solution ======== Do not explicitly define the move_assignable for `lttng::sessiond::exceptions::session_not_found_error` as `noexcept`. The function should be implicitly generated as `noexcept`. Known drawbacks =============== None. References ========== [1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59526 Change-Id: I3368633ce3b45627f2e67f7d2def361e662eec3d Signed-off-by: Kienan Stewart Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/session.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/bin/lttng-sessiond/session.hpp b/src/bin/lttng-sessiond/session.hpp index 1c9871cc2..b091c2ef3 100644 --- a/src/bin/lttng-sessiond/session.hpp +++ b/src/bin/lttng-sessiond/session.hpp @@ -574,7 +574,11 @@ public: session_not_found_error(const session_not_found_error& other) = default; ~session_not_found_error() noexcept override = default; - session_not_found_error(session_not_found_error&& other) noexcept = default; + /* + * Setting an explicit `noexcept` causes compilation failure on gcc < 5.0 + * @see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59526 + */ + session_not_found_error(session_not_found_error&& other) /* noexcept */ = default; session_not_found_error& operator=(const session_not_found_error&) = delete; session_not_found_error& operator=(session_not_found_error&&) noexcept = delete; -- 2.34.1