tcbrindle / NanoRange

Range-based goodness for C++17
Boost Software License 1.0
358 stars 28 forks source link

common_reference broken with MSVC 19.22 #75

Closed tcbrindle closed 5 years ago

tcbrindle commented 5 years ago

The latest MSVC update (v19.22) breaks our implementation of common_reference, to the extent that just #include <nanorange.hpp> generates

error C2064: term does not evaluate to a function taking 0 arguments
note: see reference to alias template instantiation 'nano::ranges::detail::cond_res_t<copy_cv<X,Y>::type&,copy_cv<Y,X>::type&>' being compiled

(See https://godbolt.org/z/VXv5gY)

The offending line seems to be https://github.com/tcbrindle/NanoRange/blob/master/include/nanorange/detail/common_reference.hpp#L68. I'm not sure of the cause -- this should be in a SFINAE context, so if evaluation of the alias causes a substitution failure, then the partial specialisation should just be ignored... or at least that's the idea.

It works correctly with Clang, GCC and previous versions of MSVC, so it may just be a compiler bug, or it may be that MSVC is now correctly diagnosing a problem that we previously got away with. Either way, this prevents NanoRange being used with the latest Windows compiler, so it needs to be fixed ASAP.

PeterFeicht commented 5 years ago

I think I ran into this at work, you wouldn't happen to have a reduced sample that triggers this? Or even filed a bug with MS?

tcbrindle commented 5 years ago

I do indeed:

https://developercommunity.visualstudio.com/content/problem/745820/alias-template-in-class-template-partial-specialis.html

On Wed, 25 Sep 2019 at 13:06, Peter Feichtinger notifications@github.com wrote:

I think I ran into this at work, you wouldn't happen to have a reduced sample that triggers this? Or even filed a bug with MS?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/tcbrindle/NanoRange/issues/75?email_source=notifications&email_token=AA4TRNF3QCDIG5GYXTHTJCLQLNH5DA5CNFSM4IZMF2PKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7RUZOQ#issuecomment-534990010, or mute the thread https://github.com/notifications/unsubscribe-auth/AA4TRNAKCE6TCFEP5UXYWRTQLNH5DANCNFSM4IZMF2PA .