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

Disable MPARK_CPP14_CONSTEXPR for MSVC <= 19.15 #49

Closed mrkline closed 5 years ago

mrkline commented 5 years ago

The latest Visual Studio 2017 update (version 15.8, MSVC 19.15) claims to support C++14 constexpr, but it does not. Compiling with MPARK_CPP14_CONSTEXPR defined emits a litany of errors, e.g.,

5>c:\...\variant\include\mpark\variant.hpp(386): error C2131: expression did not evaluate to a constant
5>c:\...\variant\include\mpark\variant.hpp(386): note: failure was caused by a read of a variable outside its lifetime
5>c:\...\variant\include\mpark\variant.hpp(386): note: see usage of '<traits_0>'
5>c:\...\variant\include\mpark\variant.hpp(1205): note: see reference to class template instantiation 'mpark::detail::traits<Redacted, Lol>' being compiled
5>c:\...\variant\include\mpark\variant.hpp(1504): note: see reference to class template instantiation 'mpark::detail::impl<Redacted, Lol>' being compiled

Disable MPARK_CPP14_CONSTEXPR for this and previous versions of MSVC, with the hope that this problem is addressed in the near future.

Fixes #48

mrkline commented 5 years ago

Hm, the CI failures seem spurious... is that normal?

mpark commented 5 years ago

Hm.. I need to take a look at the Travis CI. It seems to have been failing with a minor version update or something. Thanks for the patch!

patrikhuber commented 5 years ago

Hi! It would be great to see an update on this PR - I'm also affected by this, and more people in #48, basically everyone that has updated to VS 15.8.

patrikhuber commented 5 years ago

By the way I think a slight improvement to this PR could be made: MSVC 19.11 up to 19.14 actually worked, it was only 19.15 where this broke. So I think MPARK_CPP14_CONSTEXPR could still be enabled, except for 19.15. But not sure it's worth it, since usually people should just be on the latest minor VS version anyway.

mpark commented 5 years ago

Fixed the root cause in 657110d5ea11f344d29bce1d9609c7d76696cb64