Skip to content

Commit

Permalink
Enable the custom new implementation when using custom vtables, even …
Browse files Browse the repository at this point in the history
…without

the compiler intrinsic.
We don't need the intrinsic if we are not using virtual functions.

PiperOrigin-RevId: 676520163
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Sep 19, 2024
1 parent 1c35963 commit 01c8cab
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/google/protobuf/port.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <typename T>
constexpr bool EnableCustomNewFor() {
return true;
}
#elif ABSL_HAVE_BUILTIN(__is_bitwise_cloneable)
constexpr bool EnableCustomNew() { return true; }
template <typename T>
constexpr bool EnableCustomNewFor() {
Expand Down

0 comments on commit 01c8cab

Please sign in to comment.