[cfe-dev] Wide character test problem

John Thompson john.thompson.jtsoftware at gmail.com
Wed Oct 28 14:59:09 PDT 2009


On Windows, the type of wide characters is unsigned short, causing the
Sema/wchar.c to fail, which assumes int type.
The easiest fix seems to be to conditionalize it, as follows:

Index: test/Sema/wchar.c
===================================================================
--- test/Sema/wchar.c   (revision 85400)
+++ test/Sema/wchar.c   (working copy)
@@ -4,7 +4,11 @@
 int check_wchar_size[sizeof(*L"") == sizeof(wchar_t) ? 1 : -1];
 void foo() {
+#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
+  unsigned short t1[] = L"x";
+#else
   int t1[] = L"x";
+#endif
   wchar_t tab[] = L"x";
   int t2[] = "x";     // expected-error {{initialization}}
I considered changing the target triple, but that would lead to header
problems because of the wchar.h inclusion.

-- 
John Thompson
John.Thompson.JTSoftware at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20091028/018961db/attachment.html>


More information about the cfe-dev mailing list