>From 3a7543223a6bce187e14bbb79b2680500c29575d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 24 Apr 2017 14:14:37 +0200 Subject: [PATCH] Do not make variable initialized with ldexp() constexpr std::ldexp() is not constexpr and so cannot be used to initialize constext variables. Make the variable just const to fix compilation errors due to this when using clang or MSVC. --- bourn_cast.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bourn_cast.hpp b/bourn_cast.hpp index 1eb9fcf..c12ac5d 100644 --- a/bourn_cast.hpp +++ b/bourn_cast.hpp @@ -170,7 +170,7 @@ inline To bourn_cast(From from, std::true_type, std::false_type) using from_traits = std::numeric_limits; static_assert(to_traits::is_integer && !from_traits::is_integer, ""); - static constexpr From limit = std::ldexp(From(1), to_traits::digits); + static const From limit = std::ldexp(From(1), to_traits::digits); static constexpr bool is_twos_complement(~To(0) == -To(1)); -- 2.8.0.rc1