Get the type right for wide string literals; it's wchar_t, not char.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51586 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index e85ad03..7dda9b1 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -51,7 +51,7 @@
                             StringToks[NumStringToks-1].getLocation()));
   
   QualType StrTy = Context.CharTy;
-  // FIXME: handle wchar_t
+  if (Literal.AnyWide) StrTy = Context.getWcharType();
   if (Literal.Pascal) StrTy = Context.UnsignedCharTy;
   
   // Get an array type for the string, according to C99 6.4.5.  This includes
diff --git a/test/Sema/wchar_size.c b/test/Sema/wchar_size.c
new file mode 100644
index 0000000..a4041b9
--- /dev/null
+++ b/test/Sema/wchar_size.c
@@ -0,0 +1,3 @@
+// RUN: clang %s -fsyntax-only -verify -triple=i686-apple-darwin9
+
+int check_wchar_size[sizeof(*L"") == 4 ? 1 : -1];