lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 895c823 3/8: Do not make variable initialized


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 895c823 3/8: Do not make variable initialized with ldexp() constexpr
Date: Mon, 24 Apr 2017 16:43:51 -0400 (EDT)

branch: master
commit 895c823c0c0042f2404d6a258b5cac6148b1199e
Author: Vadim Zeitlin <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    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<From>;
     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));
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]