[libcxx] r336141 - [Win32] Overload ==, != for locale_t and long long

Pirama Arumuga Nainar via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 2 13:11:15 PDT 2018


Author: pirama
Date: Mon Jul  2 13:11:15 2018
New Revision: 336141

URL: http://llvm.org/viewvc/llvm-project?rev=336141&view=rev
Log:
[Win32] Overload ==, != for locale_t and long long

Summary:
_is_chartype_l (needed for isxdigit_l) in MinGW compares locale_t and NULL.
NULL is 'long long' for 64-bit, and this results in ambiguous overloads when
compiled with Clang.  Define a concrete overload for the operators to fix the
ambiguity.

Reviewers: mstorsjo, EricWF, srhines, danalbert

Subscribers: christof, cfe-commits, ldionne

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

Modified:
    libcxx/trunk/include/support/win32/locale_win32.h

Modified: libcxx/trunk/include/support/win32/locale_win32.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/support/win32/locale_win32.h?rev=336141&r1=336140&r2=336141&view=diff
==============================================================================
--- libcxx/trunk/include/support/win32/locale_win32.h (original)
+++ libcxx/trunk/include/support/win32/locale_win32.h Mon Jul  2 13:11:15 2018
@@ -46,6 +46,10 @@ public:
         return __left.__locale == nullptr && __right == 0;
     }
 
+    friend bool operator==(const locale_t& __left, long long __right) {
+        return __left.__locale == nullptr && __right == 0;
+    }
+
     friend bool operator==(const locale_t& __left, std::nullptr_t) {
         return __left.__locale == nullptr;
     }
@@ -66,6 +70,10 @@ public:
         return !(__left == __right);
     }
 
+    friend bool operator!=(const locale_t& __left, long long __right) {
+        return !(__left == __right);
+    }
+
     friend bool operator!=(const locale_t& __left, std::nullptr_t __right) {
         return !(__left == __right);
     }




More information about the cfe-commits mailing list