Skip to content

feat: use aliases on std::variant, std::string_view, ... in C++17

I've tried to compile lates grpc v1.75.1 and it will not compile due to Debian force absl version of variant, string_view, .. even for C++17.

The Release note for v1.70.2 declare that minimal version of C++ is 17. And since it allow in code use directly feature from C++ as is <variant>, <string_view>, but not all code is clean up from absl version. In reality it doesn't matter since absl is also compile with C++17. What is issue, that absl in Debian ii is not compatible since force to disable aliases.

This definitely changes ABI, so probably not worth to backport to Trixie, but definitely it should be merge ti next version.

Compile errors

Some compile errors to have better understanding what is the issue.

grpc-src/src/core/call/request_buffer.cc:27:34: error: no matching function for call to ‘std::variant<grpc_core::RequestBuffer::Buffering, grpc_core::RequestBuffer::Buffered, grpc_core::RequestBuffer::Streaming, grpc_core::RequestBuffer::Cancelled>::variant(absl::debian7::in_place_type_t<grpc_core::RequestBuffer::Buffering>)’
   27 | RequestBuffer::RequestBuffer() : state_(absl::in_place_type_t<Buffering>()) {}
      | 
  using State = std::variant<Buffering, Buffered, Streaming, Cancelled>;
grpc-src/src/core/transport/auth_context.cc: In member function ‘void grpc_auth_context::set_protocol(absl::debian7::string_view)’:
grpc-src/src/core/transport/auth_context.cc:156:15: error: no match for ‘operator=’ (operand types are ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} and ‘absl::debian7::string_view’)
  156 |   protocol_ = protocol;
      |               ^~~~~~~~
Edited by Frantisek Boranek

Merge request reports

Loading