Skip to content

Commit

Permalink
Merge pull request #18188 from acozzette/28-fix
Browse files Browse the repository at this point in the history
Cherry-pick: Fix compiler error with `StrongReferenceToType()`
  • Loading branch information
zhangskz authored Sep 9, 2024
2 parents 9deedf0 + 8ea3bb1 commit 5b4b3af
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/google/protobuf/port.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ inline PROTOBUF_ALWAYS_INLINE void StrongPointer() {
template <typename T>
inline PROTOBUF_ALWAYS_INLINE void StrongReferenceToType() {
static constexpr auto ptr = T::template GetStrongPointerForType<T>();
return StrongPointer<decltype(ptr), ptr>();
// This is identical to the implementation of StrongPointer() above, but it
// has to be explicitly inlined here or else Clang 19 will raise an error in
// some configurations.
asm(".reloc ., BFD_RELOC_NONE, %p0" ::"Ws"(ptr));
}
#else // .reloc
// Portable fallback. It usually generates a single LEA instruction or
Expand Down

0 comments on commit 5b4b3af

Please sign in to comment.