summaryrefslogtreecommitdiffstats
path: root/include/o3tl/safeint.hxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-04-04 10:04:41 +0200
committerStephan Bergmann <sbergman@redhat.com>2017-04-04 12:09:40 +0000
commitacbb7e3243afec515bf98b2b34454afc5320bf66 (patch)
tree3b79bb960acf6170ca6e2ed3804f93f8684cede7 /include/o3tl/safeint.hxx
parentloplugin:redundantcast (clang-cl) (diff)
downloadcore-acbb7e3243afec515bf98b2b34454afc5320bf66.tar.gz
core-acbb7e3243afec515bf98b2b34454afc5320bf66.zip
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 <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'include/o3tl/safeint.hxx')
-rw-r--r--include/o3tl/safeint.hxx4
1 files changed, 2 insertions, 2 deletions
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)
{