[PATCH] D48749: [Win32] Overload ==, != for locale_t and long long

Pirama Arumuga Nainar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 28 14:56:27 PDT 2018


pirama created this revision.
pirama added reviewers: mstorsjo, EricWF, srhines, danalbert.
Herald added subscribers: ldionne, christof.

_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.


Repository:
  rCXX libc++

https://reviews.llvm.org/D48749

Files:
  include/support/win32/locale_win32.h


Index: include/support/win32/locale_win32.h
===================================================================
--- include/support/win32/locale_win32.h
+++ include/support/win32/locale_win32.h
@@ -46,6 +46,10 @@
         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 @@
         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);
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48749.153411.patch
Type: text/x-patch
Size: 854 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180628/2293abaa/attachment-0001.bin>


More information about the cfe-commits mailing list