You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2016/06/01 21:30:16 UTC

qpid-proton git commit: PROTON 1216: Fix windows warnings from is_convertible<>

Repository: qpid-proton
Updated Branches:
  refs/heads/master 03933db67 -> 14e6dcf63


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/14e6dcf6
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/14e6dcf6
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/14e6dcf6

Branch: refs/heads/master
Commit: 14e6dcf634570460058ecfd9fd0282aa463fa5b7
Parents: 03933db
Author: Alan Conway <ac...@redhat.com>
Authored: Wed Jun 1 14:40:31 2016 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Wed Jun 1 17:23:37 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/14e6dcf6/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: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org