[all-commits] [llvm/llvm-project] b55430: [flang][msvc] Define implicit conversion from Unsi...

Michael Kruse via All-commits all-commits at lists.llvm.org
Tue Sep 29 14:42:07 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: b5543063e1bfd6195a2d34d2c892466c0050e08a
      https://github.com/llvm/llvm-project/commit/b5543063e1bfd6195a2d34d2c892466c0050e08a
  Author: Michael Kruse <llvm-project at meinersbur.de>
  Date:   2020-09-29 (Tue, 29 Sep 2020)

  Changed paths:
    M flang/include/flang/Common/uint128.h

  Log Message:
  -----------
  [flang][msvc] Define implicit conversion from UnsignedInt128 to int64_t.

The custom implementation of UnsignedInt128 has an implicit conversion operator to unit64_t, but not int64_t. Considering that the former is already truncating, and C++ implicitly converts uint64_t to int64_t, UnsignedInt128  should also support an implicit conversion to int64_t. An analogous conversion would be from uint32_t to int16_t.

Without the conversion operator overload, the msvc emits the following error:
```
descriptor-io.h(44): error C2440: 'static_cast': cannot convert from 'A' to 'int64_t'
        with
        [
            A=Fortran::common::uint128_t
        ]
```

This patch is part of the series to make flang compilable with MS Visual Studio <http://lists.llvm.org/pipermail/flang-dev/2020-July/000448.html>.

Reviewed By: klausler

Differential Revision: https://reviews.llvm.org/D88509




More information about the All-commits mailing list