[libc++] Account for Microsoft CRT const overloads
Microsoft's CRT already provides the const overloads, and it defines the
`_CRT_CONST_CORRECT_OVERLOADS` macro to indicate their presence. Check
for this macro before attempting to define our own const-correct
overloads, to avoid compiler warnings about casts dropping const
qualifiers.
llvm-svn: 313377
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 03e314bb0de338a8ff63c41ec1afd95d67281e50
diff --git a/include/wchar.h b/include/wchar.h
index a5666e1..f74fe6d 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -125,6 +125,10 @@
# if __GLIBC_PREREQ(2, 10)
# define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
# endif
+#elif defined(_LIBCPP_MSVCRT)
+# if defined(_CRT_CONST_CORRECT_OVERLOADS)
+# define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
+# endif
#endif
#if defined(__cplusplus) && !defined(_LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS) && defined(_LIBCPP_PREFERRED_OVERLOAD)