Kaydet (Commit) acbb7e32 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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/36066Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst f8cff532
......@@ -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)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment