mpark / variant

C++17 `std::variant` for C++11/14/17
https://mpark.github.io/variant
Boost Software License 1.0
659 stars 88 forks source link

Add support for MSVC 2015 cl compiler #27

Closed RedSkotina closed 7 years ago

RedSkotina commented 7 years ago

MSVC 2015 Update 3 cl.exe cant compile example from https://wandbox.org/permlink/b4NDy4VupqPWkjva https://pastebin.com/iwe2sVKy

from slack cpplang: k-ballo:

the workaround is rather trivial, just move the noexcept(...) call within a class body, but that's something that only the library can do msvc uses different name lookup implementations depending on the context in which an expression appears.. it has at least 3 different ones, each with its own different bugs

Timmmm commented 7 years ago

I don't think this is easy to support anyway - even if you change noexcept(...) to true there are a load of other errors, e.g. using for in a constexpr, which MSVC 2015 doesn't support (but 2017 does apparently).

I don't understand why MSVC 2015 is listed as compatible in the Readme. Edit: Ah wait that is Visual Studio using Clang. Might want to make that clearer/bolder?

RedSkotina commented 7 years ago

Maybe then add atleast msvc 2017 cl.exe support ? But msvc 2017 have support for std::variant from c++17.

Timmmm commented 7 years ago

MSVC 2017 has built in support for std::variant so there's not much point.

mpark commented 7 years ago

@Timmmm: Thanks for the suggestion. I've bolded Clang/LLVM for now. @RedSkotina: Are you able to share what your situation is? For example, are you wanting to use the library in a project that needs to build with MSVC 2015 directly?

RedSkotina commented 7 years ago

i use msvc 2015 update 3 native compiler for my project and want use variant type. I want upgrade my project it to vs2017 but later. So i choose mpark/variant. But msvc2015 c++14 support too outdated for mpark/variant and i anyway forced upgrade my project to msvc 2017 and use std::variant (with /std:c++latest). So you can just resolve this issue as fixed.

mpark commented 7 years ago

@RedSkotina: Ah, okay. Thanks for sharing! I'll keep it open for now.

emptyVoid commented 7 years ago

I would really love to see the support for MSVC implemented (at least for 2017). We have a fairly large cross-platform project with a dozen developers, and I can't just enable /std:c++latest without someone occasionally tripping on a C++17 feature not supported on our non-Windows platforms.

Timmmm commented 7 years ago

@emptyVoid, MSVC 2017 has official support for std::variant.

mpark commented 7 years ago

@Timmmm: @emptyVoid is saying /std:c++latest can't be enabled just yet though. which I assume is needed to get access to std::variant. @emptyVoid: I've been working on C++11 support in https://github.com/mpark/variant/tree/c%2B%2B11. I'll see how far that'll get me into MSVC. Stay tuned!

emptyVoid commented 7 years ago

Great, thanks! I really hope MSVC would be able to compile C++11 at least with their lack of proper expression SFINAE.

mpark commented 7 years ago

MSVC 2015 CL and 2017 CL with /std:c++14 are now both supported!

bysreg commented 6 years ago

@mpark sorry for replying in a closed issue, but i see that you provide a check _MSC_FULL_VER < 190024215 any reason for that version particular ? my _MSC_FULL_VER is defined to 190024210 and I can't update (for intentional reason) to that version. I tried compiling it anyway using 190024210 and it seems to be working fine.

mpark commented 6 years ago

@bysreg: Thanks for reporting this! No particular reason for 190024215. I did some vague research to figure out which version works and doesn't and had determined that one to be the latest one I could test. I've simply changed lowered the value in the latest commit: baaa75a702171596725ea0ec80c5698222c8377c