diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2008-09-11 05:16:22 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2008-09-11 05:16:22 +0000 |
commit | 6314ff264c345b5babb9faf50dad0bc68d7bd74e (patch) | |
tree | b1b3ed2db8515d22b74aedcaf93f51966806be4d /lib | |
parent | 143db71d8d87bc015fb496f71ef83b268813835a (diff) |
Do implicit conversion to bool for the condition in a do-while statement.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56096 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index 706bcddff2..d7a812cb2a 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -530,7 +530,10 @@ Sema::ActOnDoStmt(SourceLocation DoLoc, StmtTy *Body, DefaultFunctionArrayConversion(condExpr); QualType condType = condExpr->getType(); - if (!condType->isScalarType()) // C99 6.8.5p2 + if (getLangOptions().CPlusPlus) { + if (CheckCXXBooleanCondition(condExpr)) // C++ 6.4p4 + return true; + } else if (!condType->isScalarType()) // C99 6.8.5p2 return Diag(DoLoc, diag::err_typecheck_statement_requires_scalar, condType.getAsString(), condExpr->getSourceRange()); |