aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-03-01 08:32:21 +0000
committerChris Lattner <sabre@nondot.org>2008-03-01 08:32:21 +0000
commitfc62bfd41c73c6bc555b5e37f9e25dff256e72ab (patch)
treef07db4122f36730faa4697358b55bc1082ba8af5
parent5f9eae529abc0be48055ba9f4d7274f859da9e2d (diff)
character literals have char type in C++ and int type in C. Patch
by Nuno Lopes for PR2089 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47787 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--Sema/SemaExpr.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/Sema/SemaExpr.cpp b/Sema/SemaExpr.cpp
index a82d0ad7e5..72bedab464 100644
--- a/Sema/SemaExpr.cpp
+++ b/Sema/SemaExpr.cpp
@@ -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) {