Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(common): workaround GCC "ambiguous" overload errors #9144

Merged

Conversation

coryan
Copy link
Contributor

@coryan coryan commented Jun 2, 2022

We used to write code like this:

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

The idea is that only one of these overloads would be available because
of SFINAE. Some versions of GCC complain that this is ambiguous.

Fixes #9111


This change is Reviewable

@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 5970fbe2fc06bde24889509d367c4a9f224030f4

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@codecov
Copy link

codecov bot commented Jun 2, 2022

Codecov Report

Merging #9144 (33ee087) into main (52d9644) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #9144   +/-   ##
=======================================
  Coverage   94.34%   94.34%           
=======================================
  Files        1435     1435           
  Lines      128262   128267    +5     
=======================================
+ Hits       121004   121011    +7     
+ Misses       7258     7256    -2     
Impacted Files Coverage Δ
google/cloud/internal/pagination_range_test.cc 95.58% <ø> (ø)
google/cloud/internal/pagination_range.h 100.00% <100.00%> (ø)
...e/cloud/spanner/testing/cleanup_stale_instances.cc 61.11% <0.00%> (-11.12%) ⬇️
google/cloud/pubsub/subscriber_connection_test.cc 97.22% <0.00%> (-0.70%) ⬇️
...le/cloud/storage/internal/curl_download_request.cc 89.59% <0.00%> (+0.33%) ⬆️
...ud/spanner/integration_tests/client_stress_test.cc 86.18% <0.00%> (+0.65%) ⬆️
...cloud/pubsub/internal/subscription_session_test.cc 99.00% <0.00%> (+1.24%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 52d9644...33ee087. Read the comment docs.

coryan added 2 commits June 2, 2022 09:55
We used to write code like this:

```cc
template <typename U>
static auto constexpr E(U& u) {
  return std::move(*u.mutable_next_page_token());
}
template <typename U>
static auto constexpr E(U& u) {
  return std::move(u.next_page_token);
}
```

The idea is that only one of these overloads would be available because
of SFINAE.  Some versions of GCC complain that this is ambiguous.
@coryan coryan force-pushed the fix-common-workaround-mingw-w64-GCC-errors branch from 5970fbe to 33ee087 Compare June 2, 2022 16:55
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 33ee087a6e03a0ddde065b6d0ab2ade09849134e

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@coryan coryan marked this pull request as ready for review June 2, 2022 19:12
@coryan coryan requested a review from a team as a code owner June 2, 2022 19:12
Copy link
Member

@scotthart scotthart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @coryan)

@coryan coryan merged commit be0097b into googleapis:main Jun 6, 2022
@coryan coryan deleted the fix-common-workaround-mingw-w64-GCC-errors branch June 6, 2022 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to compile on windows Msys gcc 11.2.0/msvc 2022 pagination_range.h template overload
3 participants