From e6c84394ba194ddeadc8eb765f8db4c5358b9cf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Gonz=C3=A1lez=20Moreno?= Date: Tue, 5 May 2026 11:49:44 +0200 Subject: [PATCH] Fix -Werror=maybe-uninitialized with GCC 12 for ARM64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ricardo González Moreno --- 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_); }