boostorg / hana

Your standard library for metaprogramming
http://boostorg.github.io/hana
Boost Software License 1.0
1.7k stars 216 forks source link

Build Error C2039 with MSVC when using /std:c++latest (C++20) - std::is_literal_type removed #500

Closed dongkeren closed 2 years ago

dongkeren commented 2 years ago

Using version 1.7.0, boost/hana/traits.hpp line 73 is causing the error:

constexpr auto is_literal_type = detail::hana_trait{};

My workaround is simply bypass it:

if __cplusplus > 201704L

constexpr auto is_literal_type = detail::hana_trait{};

endif

Reference: https://stackoverflow.com/questions/40351816/deprecated-stdis-literal-type-in-c17

ldionne commented 2 years ago

The problem is that MSVC doesn't set the value of __cplusplus correctly unless you pass /Zc:__cplusplus: https://godbolt.org/z/c6YKTr8dh