Repository: qpid-proton Updated Branches: refs/heads/master 14e6dcf63 -> 7615e78e6 (forced update)
PROTON-1216: Fix windows warnings from is_convertible<> Locally suppress Windows warnings about legal but risky argument conversions (float/int, signed/unsigned etc.) only in template is_convertible<>. The compile-time warnings are a side effect of template instantiation by coerce<>, not an indication of risky use. coerce<> is a run-time conversion and throws run-time errors for illegal conversions. In future we may add something like safe_convert<> that throws run-time errors for risky conversions as well. Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/7615e78e Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/7615e78e Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/7615e78e Branch: refs/heads/master Commit: 7615e78e6e7576702beea30493ccae5baa95d0ab Parents: 03933db Author: Alan Conway <[email protected]> Authored: Wed Jun 1 14:40:31 2016 -0400 Committer: Alan Conway <[email protected]> Committed: Wed Jun 1 17:35:06 2016 -0400 ---------------------------------------------------------------------- .../bindings/cpp/include/proton/internal/type_traits.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7615e78e/proton-c/bindings/cpp/include/proton/internal/type_traits.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/internal/type_traits.hpp b/proton-c/bindings/cpp/include/proton/internal/type_traits.hpp index 0490823..c99c248 100644 --- a/proton-c/bindings/cpp/include/proton/internal/type_traits.hpp +++ b/proton-c/bindings/cpp/include/proton/internal/type_traits.hpp @@ -161,7 +161,17 @@ template <class From, class To> struct is_convertible : public sfinae { static yes test(const To&); static no test(...); static const From& from; + // Windows compilers warn about data-loss caused by legal conversions. We + // can't use static_cast because that will cause a hard error instead of + // letting SFINAE overload resolution select the test(...) overload. +#ifdef _WIN32 +#pragma warning( push ) +#pragma warning( disable : 4244 ) +#endif static bool const value = sizeof(test(from)) == sizeof(yes); +#ifdef _WIN32 +#pragma warning( pop ) +#endif }; } // internal --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
