From b494a2917782af04397132898026b48a60ab236d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Gonz=C3=A1lez?= Date: Tue, 5 May 2026 12:20:11 +0200 Subject: [PATCH] Fix -Werror=maybe-uninitialized with GCC 12 for ARM64 (#307) (cherry picked from commit 9e74964fe0e10863ca10f4e2f3f9ffa1cfa219df) --- include/fastcdr/xcdr/optional.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/fastcdr/xcdr/optional.hpp b/include/fastcdr/xcdr/optional.hpp index 4f353ad6..f96a9506 100644 --- a/include/fastcdr/xcdr/optional.hpp +++ b/include/fastcdr/xcdr/optional.hpp @@ -207,6 +207,10 @@ class optional //! Assigns content from an optional. optional& operator =( const optional& opt) +#if defined(__GNUC__) && __GNUC__ == 12 + __attribute__( + (noinline)) +#endif // if defined(__GNUC__) && __GNUC__ == 12 { reset(); storage_.engaged_ = opt.storage_.engaged_; @@ -304,7 +308,7 @@ class optional * * @return The contained value. */ - T&& operator *() && noexcept + T && operator *() && noexcept { return std::move(storage_.val_); } @@ -316,7 +320,7 @@ class optional * * @return The contained value. */ - const T&& operator *() const&& noexcept + const T && operator*() const && noexcept { return std::move(storage_.val_); }