[ 
https://issues.apache.org/jira/browse/MESOS-7142?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrew Schwartzmeyer reassigned MESOS-7142:
-------------------------------------------

    Assignee: Andrew Schwartzmeyer

> Revisit MSVC decltype bug
> -------------------------
>
>                 Key: MESOS-7142
>                 URL: https://issues.apache.org/jira/browse/MESOS-7142
>             Project: Mesos
>          Issue Type: Improvement
>         Environment: Windows with Visual Studio 2017 RC
>            Reporter: Andrew Schwartzmeyer
>            Assignee: Andrew Schwartzmeyer
>            Priority: Minor
>              Labels: libprocess, windows
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> Review https://reviews.apache.org/r/56781/ works around an existent and 
> acknowledged bug in MSVC. From MSVC team:
> {quote}
> 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()))
>   {
>     return this->then(std::forward<F>(f), Prefer());
>   }
> {quote}
> This issue tracks revisiting the work-around when the first patch to VS2017 
> is released, as the compiler bug itself should be fixed then.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to