MSVC expects wchar_t to be defined in stddef.h if /Zc:wchar_t- is specified
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D124026
#endif /* defined(__need_STDDEF_H_misc) */
#if defined(__need_wchar_t)
-#ifndef __cplusplus
+#if !defined(__cplusplus) || (defined(_MSC_VER) && !_NATIVE_WCHAR_T_DEFINED)
/* Always define wchar_t when modules are available. */
#if !defined(_WCHAR_T) || __has_feature(modules)
#if !__has_feature(modules)
--- /dev/null
+// RUN: %clang_cc1 -fsyntax-only -triple x86_64-pc-windows-msvc -fms-compatibility-version=17.00 -fno-wchar %s
+// MSVC defines wchar_t instead of using the builtin if /Zc:wchar_t- is passed
+
+#include <stddef.h>
+
+wchar_t c;