counting_allocator: suppress bogus -Wuse-after-free warning in GCC 12

PiperOrigin-RevId: 454932630
Change-Id: Ifc716552bb0cd7babcaf416fe28462c15b4c7f23
pull/1200/head
Derek Mauro 2 years ago committed by Copybara-Service
parent 76c7ad8241
commit bf93dba8e2
  1. 8
      absl/container/internal/counting_allocator.h

@ -80,7 +80,15 @@ class CountingAllocator {
template <typename U> template <typename U>
void destroy(U* p) { void destroy(U* p) {
Allocator allocator; 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); AllocatorTraits::destroy(allocator, p);
#if ABSL_INTERNAL_HAVE_MIN_GNUC_VERSION(12, 0)
#pragma GCC diagnostic pop
#endif
if (instance_count_ != nullptr) { if (instance_count_ != nullptr) {
*instance_count_ -= 1; *instance_count_ -= 1;
} }

Loading…
Cancel
Save