From 6d6370ee10ddcd8cacc44c2d6796800c1325c732 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 5 Sep 2010 23:29:49 +0000 Subject: [PATCH] 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 --- lib/Headers/stddef.h | 2 +- test/Sema/warn-write-strings.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) 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 +void test(wchar_t *dst) { + dst[0] = 0; // Ok. +} -- 2.40.0