Details
-
Improvement
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
-
Windows with Visual Studio 2017 RC
Description
Review https://reviews.apache.org/r/56781/ works around an existent and acknowledged bug in MSVC. From MSVC team:
I have preprocessed file from Andy yesterday, thank you. I can verify that this is a bug in the latest compiler where it’s failing to get the right context for the decltype expression for the return type of function. However, MSVC does deduce the right type from the return expression in the body. We have a bug in the compiler logged now and will be tracked for next release.
We’ll be adding Mesos project to our daily RealWorld Testing set from now on as continuous validation for MSVC compiler. Thank you for bringing this up to our attention.template <typename F>
auto then(F&& f) const-> decltype(this->then(std::forward<F>(f), Prefer()))Should really expand to this expression, but it’s failing.
template <typename F>
auto then(F&& f) const> decltype(static_cast<const Future<T>*>(this)>then(std::forward<F>(f), Prefer()))The workaround from Michael to skip explicit return type for auto function should be actually better source change for MSVC compiler. For completeness sake, you can also just remove ‘this->’ from the decltype expression to make it work for MSVC compiler
-> decltype(then(std::forward<F>(f), Prefer()))Another thing worth pointing out is, adding ‘this->’ in the body of the function shows that MSVC does correctly deduce the return type.
template <typename F>
auto then(F&& f) const
// -> decltype(then(std::forward<F>(f), Prefer()))
//> decltype(static_cast<const Future<T>*>(this)>then(std::forward<F>(f), Prefer()))Unknown macro: { return this->then(std}
This issue tracks revisiting the work-around when the first patch to VS2017 is released, as the compiler bug itself should be fixed then.
Attachments
Issue Links
- is duplicated by
-
MESOS-3993 Fix up future.hpp after MSVC update 2
- Resolved
- relates to
-
MESOS-7297 Deprecate Visual Studio 14 2015
- Resolved