safe cast int to void*

pull/35557/head
Esun Kim 10 months ago
parent 1751f1043e
commit e86a90ee52
  1. 4
      src/core/lib/channel/channel_args.h

@ -326,7 +326,9 @@ class ChannelArgs {
class Value {
public:
explicit Value(int n) : rep_(reinterpret_cast<void*>(n), &int_vtable_) {}
explicit Value(int n)
: rep_(reinterpret_cast<void*>(static_cast<intptr_t>(n)),
&int_vtable_) {}
explicit Value(std::string s)
: rep_(RefCountedString::Make(s).release(), &string_vtable_) {}
explicit Value(Pointer p) : rep_(std::move(p)) {}

Loading…
Cancel
Save