From: Anders Carlsson Date: Wed, 6 Apr 2011 18:42:48 +0000 (+0000) Subject: Wide Pascal strings should be of type wchar_t[] and not unsigned char[]. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=96b4adce3bd41a33e3f1d98dc4e74046585f6dce;p=clang Wide Pascal strings should be of type wchar_t[] and not unsigned char[]. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129017 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 55155efa69..13ac32dcb1 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -744,8 +744,10 @@ Sema::ActOnStringLiteral(const Token *StringToks, unsigned NumStringToks) { StringTokLocs.push_back(StringToks[i].getLocation()); QualType StrTy = Context.CharTy; - if (Literal.AnyWide) StrTy = Context.getWCharType(); - if (Literal.Pascal) StrTy = Context.UnsignedCharTy; + if (Literal.AnyWide) + StrTy = Context.getWCharType(); + else if (Literal.Pascal) + StrTy = Context.UnsignedCharTy; // A C++ string literal has a const-qualified element type (C++ 2.13.4p1). if (getLangOptions().CPlusPlus || getLangOptions().ConstStrings) diff --git a/test/SemaCXX/pascal-wchar-strings.cpp b/test/SemaCXX/pascal-wchar-strings.cpp new file mode 100644 index 0000000000..db80b68b37 --- /dev/null +++ b/test/SemaCXX/pascal-wchar-strings.cpp @@ -0,0 +1,2 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s -fpascal-strings +const wchar_t *pascalString = L"\pThis is a Pascal string";