jeudi 28 avril 2022

ambiguous call of overload template function using decltype in google client library

I'm currently tried to build google cloud client libraries on windows. On build the final library I run into function call is ambiguous. They have the below code in a header pagination_range.h. The issue google response class sometimes have both or none of the declared functions would this ever be able to run/compile with c++11 in msys or msvc

typename StreamReader<T>::result_type GetNext() {
    if (current_ == page_.end()) {
      if (last_page_) return Status{};
      request_.set_page_token(std::move(token_));
      auto response = loader_(request_);
      if (!response.ok()) return std::move(response).status();
      token_ = ExtractPageToken(*response);
      if (token_.empty()) last_page_ = true;
      page_ = extractor_(*std::move(response));
      current_ = page_.begin();
      if (current_ == page_.end()) return Status{};
    }
    return std::move(*current_++);

template <typename U>
  static constexpr auto ExtractPageToken(U& u)
      -> decltype(std::move(*u.mutable_next_page_token())) {
    return std::move(*u.mutable_next_page_token());
  }
  template <typename U>
  static constexpr auto ExtractPageToken(U& u)
      -> decltype(std::move(u.next_page_token)) {
    return std::move(u.next_page_token);
  }

Aucun commentaire:

Enregistrer un commentaire