From b0c4444687f8450f0ce28ec8caec02f4c71d4bfc Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Tue, 27 Sep 2016 11:23:52 +0200 Subject: [PATCH] format_descr constexpr tweak for MSVC by @jagerman (fixes #416) --- include/pybind11/common.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/pybind11/common.h b/include/pybind11/common.h index 86af6993a..f1b023c91 100644 --- a/include/pybind11/common.h +++ b/include/pybind11/common.h @@ -443,9 +443,9 @@ PYBIND11_RUNTIME_EXCEPTION(reference_cast_error, PyExc_RuntimeError) /// Used in template struct format_descriptor { }; template struct format_descriptor::value>> { - static constexpr const char value[2] = - { "bBhHiIqQ"[detail::log2(sizeof(T))*2 + (std::is_unsigned::value ? 1 : 0)], '\0' }; - static std::string format() { return value; } + static constexpr const char c = "bBhHiIqQ"[detail::log2(sizeof(T))*2 + std::is_unsigned::value]; + static constexpr const char value[2] = { c, '\0' }; + static std::string format() { return std::string(1, c); } }; template constexpr const char format_descriptor<