aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaCXXCast.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2009-07-29 13:50:23 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2009-07-29 13:50:23 +0000
commitef0cb8e62d090ad88a01ca9fa89e48d7416f0ac7 (patch)
tree58b7e8f12a33c784db0cf35a0f810f546d768b92 /lib/Sema/SemaCXXCast.cpp
parentd9b401c0856fb2194855e8ee5f80908b91b598c4 (diff)
Make functional-style casts emit correct messages, and fix a crash-on-invalid.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77451 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCXXCast.cpp')
-rw-r--r--lib/Sema/SemaCXXCast.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Sema/SemaCXXCast.cpp b/lib/Sema/SemaCXXCast.cpp
index f83a9f291a..99bf84565d 100644
--- a/lib/Sema/SemaCXXCast.cpp
+++ b/lib/Sema/SemaCXXCast.cpp
@@ -999,7 +999,8 @@ static TryCastResult TryReinterpretCast(Sema &Self, Expr *SrcExpr,
}
-bool Sema::CXXCheckCStyleCast(SourceRange R, QualType CastTy, Expr *&CastExpr)
+bool Sema::CXXCheckCStyleCast(SourceRange R, QualType CastTy, Expr *&CastExpr,
+ bool FunctionalStyle)
{
// This test is outside everything else because it's the only case where
// a non-lvalue-reference target type does not lead to decay.
@@ -1036,9 +1037,8 @@ bool Sema::CXXCheckCStyleCast(SourceRange R, QualType CastTy, Expr *&CastExpr)
}
}
- // FIXME: Differentiate functional-style and C-style cast.
if (tcr != TC_Success && msg != 0)
- Diag(R.getBegin(), msg) << CT_CStyle
+ Diag(R.getBegin(), msg) << (FunctionalStyle ? CT_Functional : CT_CStyle)
<< CastExpr->getType() << CastTy << R;
return tcr != TC_Success;