From acbb7e3243afec515bf98b2b34454afc5320bf66 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 4 Apr 2017 10:04:41 +0200 Subject: 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 Reviewed-by: Stephan Bergmann --- include/o3tl/safeint.hxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/o3tl/safeint.hxx') 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 -#if defined(_MSC_VER) +#if defined(_MSC_VER) && !defined __clang__ #include #else #ifndef __has_builtin @@ -22,7 +22,7 @@ namespace o3tl { -#if defined(_MSC_VER) +#if defined(_MSC_VER) && !defined __clang__ template inline bool checked_multiply(T a, T b, T& result) { -- cgit