aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-09-05 23:29:49 +0000
committerChris Lattner <sabre@nondot.org>2010-09-05 23:29:49 +0000
commit6d6370ee10ddcd8cacc44c2d6796800c1325c732 (patch)
tree2235fbb067a4c51b0902efdb4bc91679f5ad1bfa
parent343d65c0739f9d4d6c6345a38a7228bafb1de4df (diff)
fix PR7192 by defining wchar_t in a more conventional way. The
type of L"x" can change based on command line arguments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113127 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Headers/stddef.h2
-rw-r--r--test/Sema/warn-write-strings.c6
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/Headers/stddef.h b/lib/Headers/stddef.h
index fdd48159ba..84ec1a7b4e 100644
--- a/lib/Headers/stddef.h
+++ b/lib/Headers/stddef.h
@@ -34,7 +34,7 @@ typedef __typeof__(sizeof(int)) size_t;
#ifndef __cplusplus
#ifndef _WCHAR_T
#define _WCHAR_T
-typedef __typeof__(*L"") wchar_t;
+typedef __WCHAR_TYPE__ wchar_t;
#endif
#endif
diff --git a/test/Sema/warn-write-strings.c b/test/Sema/warn-write-strings.c
index 450d0a6fe6..dd0bb8a6d8 100644
--- a/test/Sema/warn-write-strings.c
+++ b/test/Sema/warn-write-strings.c
@@ -2,3 +2,9 @@
// PR4804
char* x = "foo"; // expected-warning {{initializing 'char *' with an expression of type 'const char [4]' discards qualifiers}}
+
+// PR7192
+#include <stddef.h>
+void test(wchar_t *dst) {
+ dst[0] = 0; // Ok.
+}