From 01c8cab1cdd50c36e29cdcbb3da76dc013a0517f Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Thu, 19 Sep 2024 12:34:51 -0700 Subject: [PATCH] Enable the custom new implementation when using custom vtables, even without the compiler intrinsic. We don't need the intrinsic if we are not using virtual functions. PiperOrigin-RevId: 676520163 --- src/google/protobuf/port.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/google/protobuf/port.h b/src/google/protobuf/port.h index 9ad6d8a166..44dbc50c55 100644 --- a/src/google/protobuf/port.h +++ b/src/google/protobuf/port.h @@ -379,7 +379,13 @@ constexpr T* Launder(T* p) { #endif } -#if ABSL_HAVE_BUILTIN(__is_bitwise_cloneable) +#if defined(PROTOBUF_CUSTOM_VTABLE) +constexpr bool EnableCustomNew() { return true; } +template +constexpr bool EnableCustomNewFor() { + return true; +} +#elif ABSL_HAVE_BUILTIN(__is_bitwise_cloneable) constexpr bool EnableCustomNew() { return true; } template constexpr bool EnableCustomNewFor() {