summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Sema/SemaExpr.cpp2
-rw-r--r--clang/test/Sema/wchar_size.c3
2 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index e85ad03694a..7dda9b141d4 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -51,7 +51,7 @@ Sema::ActOnStringLiteral(const Token *StringToks, unsigned NumStringToks) {
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/clang/test/Sema/wchar_size.c b/clang/test/Sema/wchar_size.c
new file mode 100644
index 00000000000..a4041b976da
--- /dev/null
+++ b/clang/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];
OpenPOWER on IntegriCloud