Fix for PR6220: compute the correct type for multicharacter literals.

llvm-svn: 95228
This commit is contained in:
Eli Friedman 2010-02-03 18:21:45 +00:00
parent e3ee332fe0
commit eb1df70bdc
2 changed files with 11 additions and 0 deletions

View File

@ -1668,6 +1668,8 @@ Sema::OwningExprResult Sema::ActOnCharacterConstant(const Token &Tok) {
Ty = Context.IntTy; // 'x' and L'x' -> int in C.
else if (Literal.isWide())
Ty = Context.WCharTy; // L'x' -> wchar_t in C++.
else if (Literal.isMultiChar())
Ty = Context.IntTy; // 'wxyz' -> int in C++.
else
Ty = Context.CharTy; // 'x' -> char in C++

View File

@ -0,0 +1,9 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// Check types of char literals
extern char a;
extern __typeof('a') a;
extern int b;
extern __typeof('asdf') b;
extern wchar_t c;
extern __typeof(L'a') c;