Skip to content

Commit 5b4b3af

Browse files
authored
Merge pull request #18188 from acozzette/28-fix
Cherry-pick: Fix compiler error with `StrongReferenceToType()`
2 parents 9deedf0 + 8ea3bb1 commit 5b4b3af

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/google/protobuf/port.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ inline PROTOBUF_ALWAYS_INLINE void StrongPointer() {
6464
template <typename T>
6565
inline PROTOBUF_ALWAYS_INLINE void StrongReferenceToType() {
6666
static constexpr auto ptr = T::template GetStrongPointerForType<T>();
67-
return StrongPointer<decltype(ptr), ptr>();
67+
// This is identical to the implementation of StrongPointer() above, but it
68+
// has to be explicitly inlined here or else Clang 19 will raise an error in
69+
// some configurations.
70+
asm(".reloc ., BFD_RELOC_NONE, %p0" ::"Ws"(ptr));
6871
}
6972
#else // .reloc
7073
// Portable fallback. It usually generates a single LEA instruction or

0 commit comments

Comments
 (0)