[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));
- [lmi-commits] [lmi] master updated (29808d8 -> 2f1cecc), Greg Chicares, 2017/04/24
- [lmi-commits] [lmi] master 27584b1 1/8: Use is_signed to differentiate between signed and unsigned, Greg Chicares, 2017/04/24
- [lmi-commits] [lmi] master 895c823 3/8: Do not make variable initialized with ldexp() constexpr,
Greg Chicares <=
- [lmi-commits] [lmi] master b5fe551 4/8: Write 'const' after the type it modifies, Greg Chicares, 2017/04/24
- [lmi-commits] [lmi] master a9c5ed5 7/8: Resolve a marked defect [389], Greg Chicares, 2017/04/24
- [lmi-commits] [lmi] master 6327528 6/8: Use C++11 overloads for C99 <math.h> functions, Greg Chicares, 2017/04/24
- [lmi-commits] [lmi] master 461c143 2/8: Replace boost::numeric_cast with bourn_cast, Greg Chicares, 2017/04/24
- [lmi-commits] [lmi] master dea45f1 5/8: Avoid 'static constexpr' locals, Greg Chicares, 2017/04/24
- [lmi-commits] [lmi] master 2f1cecc 8/8: Explicitly qualify std::fabs(), Greg Chicares, 2017/04/24