[flang-commits] [flang] 02410df - [flang] Fix Windows build

peter klausler via flang-commits flang-commits at lists.llvm.org
Tue Oct 12 17:16:06 PDT 2021


Author: peter klausler
Date: 2021-10-12T17:16:00-07:00
New Revision: 02410df530fbef5256711ec2220c4c34468c894c

URL: https://github.com/llvm/llvm-project/commit/02410df530fbef5256711ec2220c4c34468c894c
DIFF: https://github.com/llvm/llvm-project/commit/02410df530fbef5256711ec2220c4c34468c894c.diff

LOG: [flang] Fix Windows build

A recently added class constructor needs to be "explicit" to
prevent it from being available for use as a conversion, which
is breaking the MSVC build of flang.

Added: 
    

Modified: 
    flang/include/flang/Common/uint128.h

Removed: 
    


################################################################################
diff  --git a/flang/include/flang/Common/uint128.h b/flang/include/flang/Common/uint128.h
index 68098da282f2..adbeeb3fe6fd 100644
--- a/flang/include/flang/Common/uint128.h
+++ b/flang/include/flang/Common/uint128.h
@@ -47,16 +47,19 @@ template <bool IS_SIGNED = false> class Int128 {
   constexpr Int128 &operator=(const Int128 &) = default;
   constexpr Int128 &operator=(Int128 &&) = default;
 
-  constexpr Int128(const Int128<!IS_SIGNED> &n)
+  explicit constexpr Int128(const Int128<!IS_SIGNED> &n)
+      : low_{n.low()}, high_{n.high()} {}
+  explicit constexpr Int128(Int128<!IS_SIGNED> &&n)
       : low_{n.low()}, high_{n.high()} {}
-  constexpr Int128(Int128<!IS_SIGNED> &&n) : low_{n.low()}, high_{n.high()} {}
   constexpr Int128 &operator=(const Int128<!IS_SIGNED> &n) {
     low_ = n.low();
     high_ = n.high();
+    return *this;
   }
   constexpr Int128 &operator=(Int128<!IS_SIGNED> &&n) {
     low_ = n.low();
     high_ = n.high();
+    return *this;
   }
 
   constexpr Int128 operator+() const { return *this; }


        


More information about the flang-commits mailing list