diff options
author | Richard Trieu <rtrieu@google.com> | 2015-05-20 23:29:18 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2015-05-20 23:29:18 +0000 |
commit | cbab79a4f8853bd796bf6b90de48e64a5728e8c0 (patch) | |
tree | 6d7ee850b39c2a9166fc425061da10278d3d6170 /clang/lib/Sema/SemaExpr.cpp | |
parent | 69fc4418ab2845a5cbbd08c913ec16c6f73890ad (diff) | |
download | bcm5719-llvm-cbab79a4f8853bd796bf6b90de48e64a5728e8c0.tar.gz bcm5719-llvm-cbab79a4f8853bd796bf6b90de48e64a5728e8c0.zip |
Check for bool-like conversion in conditional expressions.
Add a check for bool-like conversions for the condition expression of
conditional operators. This is similiar to the checking of condition
expressions of if statements, for-loops, while-loops, and do-while loops.
Specificially, this is to fix the problem of assert("message") not triggering
-Wstring-conversion when the assert macro uses a conditional operator.
llvm-svn: 237856
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index a2b0fe8fc26..3fa05e417ff 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -6528,6 +6528,8 @@ ExprResult Sema::ActOnConditionalOp(SourceLocation QuestionLoc, DiagnoseConditionalPrecedence(*this, QuestionLoc, Cond.get(), LHS.get(), RHS.get()); + CheckBoolLikeConversion(Cond.get(), QuestionLoc); + if (!commonExpr) return new (Context) ConditionalOperator(Cond.get(), QuestionLoc, LHS.get(), ColonLoc, |