[omg] Avoid MSVC miscompile (#36893)

Seems MSVC has trouble compiling this statically initialized lambda in a template; crash goes away when I split it out to be a named function instead.

Closes #36893

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36893 from ctiller:edward 4bf9b88797
PiperOrigin-RevId: 642714465
pull/36447/head^2
Craig Tiller 6 months ago committed by Copybara-Service
parent fdac9ebfdf
commit 8564f72e8e
  1. 10
      src/core/lib/resource_quota/arena.h

@ -94,8 +94,13 @@ class ArenaContextTraits : public BaseArenaContextTraits {
};
template <typename T>
const uint16_t ArenaContextTraits<T>::id_ = BaseArenaContextTraits::MakeId(
[](void* ptr) { ArenaContextType<T>::Destroy(static_cast<T*>(ptr)); });
void DestroyArenaContext(void* p) {
ArenaContextType<T>::Destroy(static_cast<T*>(p));
}
template <typename T>
const uint16_t ArenaContextTraits<T>::id_ =
BaseArenaContextTraits::MakeId(DestroyArenaContext<T>);
template <typename T, typename A, typename B>
struct IfArray {
@ -283,6 +288,7 @@ class Arena final : public RefCounted<Arena, NonPolymorphicRefCount,
ArenaContextType<T>::Destroy(static_cast<T*>(slot));
}
slot = context;
DCHECK_EQ(GetContext<T>(), context);
}
private:

Loading…
Cancel
Save