summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Derek Mauro <dmauro@google.com>2022-06-14 13:51:01 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2022-06-14 13:51:49 -0700
commitd66e0dc6cc3c0ce647a9c238aa30d7b867f87317 (patch)
tree36e8ce11c0fe11e3ab9986bbad7e3a8c5d82bc82
parent10ec11de9c169c5a8ae6d29a09beae6b0d624e91 (diff)
absl::Optional: suppress bogus -Wmaybe-uninitialized GCC 12 warning
PiperOrigin-RevId: 454947125 Change-Id: Idbe6c8b4953c3d6147326bebc915d24dff83e7d5
-rw-r--r--absl/types/internal/optional.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/absl/types/internal/optional.h b/absl/types/internal/optional.h
index 92932b60..6ed0c669 100644
--- a/absl/types/internal/optional.h
+++ b/absl/types/internal/optional.h
@@ -91,7 +91,15 @@ class optional_data_dtor_base {
void destruct() noexcept {
if (engaged_) {
+ // `data_` must be initialized if `engaged_` is true.
+#if ABSL_INTERNAL_HAVE_MIN_GNUC_VERSION(12, 0)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#endif
data_.~T();
+#if ABSL_INTERNAL_HAVE_MIN_GNUC_VERSION(12, 0)
+#pragma GCC diagnostic pop
+#endif
engaged_ = false;
}
}