Commit 018a9fe6 authored by Marshall Cline's avatar Marshall Cline Committed by Facebook Github Bot

workaround gcc oddity with Future::semi()

Summary:
Prior to this diff, the two `Future::semi()` overloads were logically the same but used different symbols:
* rvalue-qualified overload returned `Future<T>`
* lvalue-qualified overload returned `auto` (which resolved to `Future<T>`)

This seemingly innocuous difference caused gcc to choke: when the `this` object was a `Future<...>` object returned by value, gcc reported the following error: "error: call of overloaded ‘semi()’ is ambiguous", specifically pointing to the two `Future::semi()` overloads.

Conversely clang had no problem with that callsite.

gcc stopped issuing the spurious error-message after this diff's changes, that is, after making the signatures of the two overloads identical in every respect except for the rvalue-qualification vs. lvalue-qualification.

Reviewed By: LeeHowes

Differential Revision: D9475854

fbshipit-source-id: 5fb20f6c57eaf6a5f9b7cb6cdb49782e40704953
parent 9addc8b4
...@@ -1880,7 +1880,7 @@ class Future : private futures::detail::FutureBase<T> { ...@@ -1880,7 +1880,7 @@ class Future : private futures::detail::FutureBase<T> {
return SemiFuture<T>{std::move(*this)}; return SemiFuture<T>{std::move(*this)};
} }
auto semi() & { SemiFuture<T> semi() & {
return std::move(*this).semi(); return std::move(*this).semi();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment