[libc-commits] [libc] [libc] Do not redefine `wchar_t` when compiling in C++ (PR #110769)
Joseph Huber via libc-commits
libc-commits at lists.llvm.org
Tue Oct 1 17:04:15 PDT 2024
https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/110769
Summary:
This is a fundamental type in C++, so we can't redefine it.
>From 7a6cafcd9bec389569ff4e84617fd3e1f70169d9 Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Tue, 1 Oct 2024 19:01:40 -0500
Subject: [PATCH] [libc] Do not redefine `wchar_t` when compiling in C++
Summary:
This is a fundamental type in C++, so we can't redefine it.
---
libc/include/llvm-libc-types/wchar_t.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libc/include/llvm-libc-types/wchar_t.h b/libc/include/llvm-libc-types/wchar_t.h
index faa40d96efc4d2..bf2633a1c244bf 100644
--- a/libc/include/llvm-libc-types/wchar_t.h
+++ b/libc/include/llvm-libc-types/wchar_t.h
@@ -9,6 +9,11 @@
#ifndef LLVM_LIBC_TYPES_WCHAR_T_H
#define LLVM_LIBC_TYPES_WCHAR_T_H
+// wchar_t is a fundamental type in C++.
+#ifndef __cplusplus
+
typedef __WCHAR_TYPE__ wchar_t;
+#endif
+
#endif // LLVM_LIBC_TYPES_WCHAR_T_H
More information about the libc-commits
mailing list