character literals have char type in C++ and int type in C. Patch

by Nuno Lopes for PR2089

llvm-svn: 47787
This commit is contained in:
Chris Lattner 2008-03-01 08:32:21 +00:00
parent a683edb2d8
commit ef24b38d9c
1 changed files with 4 additions and 2 deletions

View File

@ -157,8 +157,10 @@ Sema::ExprResult Sema::ActOnCharacterConstant(const Token &Tok) {
Tok.getLocation(), PP);
if (Literal.hadError())
return ExprResult(true);
return new CharacterLiteral(Literal.getValue(), Context.IntTy,
Tok.getLocation());
QualType type = getLangOptions().CPlusPlus ? Context.CharTy : Context.IntTy;
return new CharacterLiteral(Literal.getValue(), type, Tok.getLocation());
}
Action::ExprResult Sema::ActOnNumericConstant(const Token &Tok) {