include/o3tl/safeint.hxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit acbb7e3243afec515bf98b2b34454afc5320bf66
Author: Stephan Bergmann <sberg...@redhat.com>
Date:   Tue Apr 4 10:04:41 2017 +0200

    Work around clang-cl issue with MSVC's safeint.h for now
    
    At least some C:\Program Files (x86)\Windows 
Kits\10\Include\10.0.10240.0\ucrt\
    safeint_internal.h, in the specialization of 
LargeIntRegMultiply::RegMultiply
    for signed __int64, contains an (unnecessary) C-style cast from l-value 
unsigned
    __int64 tmp
    
      RegMultiply( ..., ..., (unsigned _int64)tmp ) == SafeIntNoError )
    
    which clang-cl correctly identifies as producing a prvalue (so cannot bind 
to
    the third 'unsigned __int64& ret' parameter of that RegMultiply call), while
    MSVC apparently has a non-standard mis-feature of treating such a 
"self-cast" as
    an lvalue.
    
    Until clang-cl learns about that mis-feature too, use the fallback
    implementation of o3tl/safeint.hxx when compiling with clang-cl.
    
    Change-Id: I7a454134589d958ad7ba845c37584b3aa7b94926
    Reviewed-on: https://gerrit.libreoffice.org/36066
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/include/o3tl/safeint.hxx b/include/o3tl/safeint.hxx
index ce144d22d9ea..e4eee64ff2fd 100644
--- a/include/o3tl/safeint.hxx
+++ b/include/o3tl/safeint.hxx
@@ -11,7 +11,7 @@
 #define INCLUDED_O3TL_SAFEINT_HXX
 
 #include <limits>
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && !defined __clang__
 #include <safeint.h>
 #else
 #ifndef __has_builtin
@@ -22,7 +22,7 @@
 namespace o3tl
 {
 
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && !defined __clang__
 
 template<typename T> inline bool checked_multiply(T a, T b, T& result)
 {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to