[libcxx-commits] [clang] [libcxx] [libc++] Don't dispatch find to wmemchr under -fshort-wchar (PR #203621)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 16 11:58:54 PDT 2026


================
@@ -197,6 +197,15 @@ using ::putwchar _LIBCPP_USING_IF_EXISTS;
 using ::vwprintf _LIBCPP_USING_IF_EXISTS;
 using ::wprintf _LIBCPP_USING_IF_EXISTS;
 
+// Names the platform-native wchar_t (the type wchar_t would have without
+// -fshort-wchar). Falls back to wchar_t on compilers that predate
+// __WCHAR_NATIVE_TYPE__ (Clang < 23), preserving prior behavior.
----------------
ldionne wrote:

The problem with this though is that on compilers that provide the `-fshort-wchar` extension but don't define `__WCHAR_NATIVE_TYPE__`, we break. I care less about Clang < 23 (which we know has the bug), but more about GCC which probably doesn't have any intention to ever provide `__WCHAR_NATIVE_TYPE__`? That would leave libc++ broken on GCC without a diagnostic, forever.

https://github.com/llvm/llvm-project/pull/203621


More information about the libcxx-commits mailing list