[cfe-commits] r47787 - /cfe/trunk/Sema/SemaExpr.cpp
Chris Lattner
sabre at nondot.org
Sat Mar 1 00:32:21 PST 2008
Author: lattner
Date: Sat Mar 1 02:32:21 2008
New Revision: 47787
URL: http://llvm.org/viewvc/llvm-project?rev=47787&view=rev
Log:
character literals have char type in C++ and int type in C. Patch
by Nuno Lopes for PR2089
Modified:
cfe/trunk/Sema/SemaExpr.cpp
Modified: cfe/trunk/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaExpr.cpp?rev=47787&r1=47786&r2=47787&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/Sema/SemaExpr.cpp Sat Mar 1 02:32:21 2008
@@ -157,8 +157,10 @@
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) {
More information about the cfe-commits
mailing list