Sprout
Sprout copied to clipboard
C++20 removed std::is_literal_type
std::is_literal_type
was deprecated in C++17 and removed in C++20. Section [diff.cpp17.depr]/7 of the C++20 Working Draft explains:
The traits had unreliable or awkward interfaces. The
is_literal_type
trait provided no way to detect which subset of constructors and member functions of a type were declaredconstexpr
.
This trait is being directly used here:
https://github.com/bolero-MURAKAMI/Sprout/blob/6b5addba9face0a6403e66e7db2aa94d87387f61/sprout/type_traits/is_literal_type.hpp#L21
In /std:c++17
mode, this triggers a deprecation warning in recent versions of MSVC. In /std:c++latest
mode, now that https://github.com/microsoft/STL/pull/380 has been merged, this will trigger an error in VS 2019 16.6 Preview 2.
MSVC provides "escape hatch" macros that can be defined project-wide to suppress the deprecation warning and restore the removed type trait. (Specifically, compiling with /D_SILENCE_CXX17_IS_LITERAL_TYPE_DEPRECATION_WARNING
and /D_HAS_DEPRECATED_IS_LITERAL_TYPE=1
.) However, it's best to avoid using this deprecated/removed machinery entirely.
I see at least three uses of sprout::is_literal_type
throughout your codebase, but I'm uncertain as to how it's being used. I looked at prev
, where it appears to be dispatching to logarithmic-depth recursion, possibly as a workaround when C++14 extended constexpr
is unavailable. If all uses of is_literal_type
are for dealing with the limitations of C++11 classic constexpr
, you may want to detect whether C++14 extended constexpr
is available, and if so, avoid is_literal_type
entirely (which should solve the deprecation/removal issue with the latest versions of MSVC).