From 1b322540fa0fce561cf86e371dd7f304f1343511 Mon Sep 17 00:00:00 2001 From: Owen Avery Date: Mon, 5 Jun 2023 15:54:08 -0400 Subject: Prevent initialization related warnings/errors for Optional https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635#c53 gcc/rust/ChangeLog: * util/rust-optional.h (class Optional): Add volatile field to union. Signed-off-by: Owen Avery --- gcc/rust/util/rust-optional.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gcc/rust/util') diff --git a/gcc/rust/util/rust-optional.h b/gcc/rust/util/rust-optional.h index d3dfb7f..bdfbd28 100644 --- a/gcc/rust/util/rust-optional.h +++ b/gcc/rust/util/rust-optional.h @@ -86,6 +86,10 @@ private: union { T value; + // prevents initialization warnings + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635#c53 + // FIXME: remove + volatile char unused; }; Optional (tag_some, const T &value) : field_is_some (true), value (value) {} -- cgit v1.1