mesos-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Schwartzmeyer (JIRA)" <>
Subject [jira] [Assigned] (MESOS-7142) Revisit MSVC decltype bug
Date Tue, 02 Oct 2018 21:45:01 GMT


Andrew Schwartzmeyer reassigned MESOS-7142:

    Assignee:     (was: Andrew Schwartzmeyer)

> Revisit MSVC decltype bug
> -------------------------
>                 Key: MESOS-7142
>                 URL:
>             Project: Mesos
>          Issue Type: Improvement
>         Environment: Windows with Visual Studio 2017 RC
>            Reporter: Andrew Schwartzmeyer
>            Priority: Minor
>              Labels: libprocess, windows
>   Original Estimate: 2h
>  Remaining Estimate: 2h
> Review 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),
> 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),
> 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),
>   {
>     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

View raw message