Fix: Compilation failure in session_not_found_error with GCC 4.8
authorKienan Stewart <kstewart@efficios.com>
Tue, 6 Aug 2024 15:14:49 +0000 (11:14 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 22 Aug 2024 17:25:48 +0000 (13:25 -0400)
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 <kstewart@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/session.hpp

index 1c9871cc287f9bc79b86bd74016723192f04dc96..b091c2ef3d0c17d5c89d3590db71f82e4d9190b3 100644 (file)
@@ -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;
 
This page took 0.026259 seconds and 4 git commands to generate.