From d469ccfd4f8e2c7f3c0359c481d58231572a44d9 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 21 Apr 2022 10:13:43 +0200 Subject: Suppress bogus use-after-free warning in GCC 12 (GCC bug #105327) --- odb/traits.hxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/odb/traits.hxx b/odb/traits.hxx index 1cb2613..2c6f5d6 100644 --- a/odb/traits.hxx +++ b/odb/traits.hxx @@ -71,6 +71,14 @@ namespace odb typedef T value_type; typedef P pointer_type; + + // Suppress bogus use-after-free introduced in GCC 12 (GCC bug #105327). + // +#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 12 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wuse-after-free" +#endif + static P create () { @@ -81,6 +89,10 @@ namespace odb return p; } +#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 12 +#pragma GCC diagnostic pop +#endif + private: struct mem_guard { -- cgit v1.1