summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Derek Mauro <dmauro@google.com>2022-06-14 12:48:22 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2022-06-14 12:48:56 -0700
commitbf93dba8e2058c64fc1140c9035bbf9bbe20bfdf (patch)
tree2b91c116163b0436bb6904ed7ff96c4df8563150
parent76c7ad82415813cc0354647e4b9b73eaf68a9da0 (diff)
counting_allocator: suppress bogus -Wuse-after-free warning in GCC 12
PiperOrigin-RevId: 454932630 Change-Id: Ifc716552bb0cd7babcaf416fe28462c15b4c7f23
-rw-r--r--absl/container/internal/counting_allocator.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/absl/container/internal/counting_allocator.h b/absl/container/internal/counting_allocator.h
index 927cf082..66068a5a 100644
--- a/absl/container/internal/counting_allocator.h
+++ b/absl/container/internal/counting_allocator.h
@@ -80,7 +80,15 @@ class CountingAllocator {
template <typename U>
void destroy(U* p) {
Allocator allocator;
+ // Ignore GCC warning bug.
+#if ABSL_INTERNAL_HAVE_MIN_GNUC_VERSION(12, 0)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wuse-after-free"
+#endif
AllocatorTraits::destroy(allocator, p);
+#if ABSL_INTERNAL_HAVE_MIN_GNUC_VERSION(12, 0)
+#pragma GCC diagnostic pop
+#endif
if (instance_count_ != nullptr) {
*instance_count_ -= 1;
}