diff options
| author | Eli Friedman <eli.friedman@gmail.com> | 2008-06-04 19:47:51 +0000 |
|---|---|---|
| committer | Eli Friedman <eli.friedman@gmail.com> | 2008-06-04 19:47:51 +0000 |
| commit | 3e1852fa7ee4a225c1a351bc76752e91a7f18b1f (patch) | |
| tree | d42dc72e5697683d14c73bf977b0179a663c6978 /clang/lib/Sema/SemaExpr.cpp | |
| parent | 2425cd815835fd941a65bda2d602ccc7216867ed (diff) | |
| download | bcm5719-llvm-3e1852fa7ee4a225c1a351bc76752e91a7f18b1f.tar.gz bcm5719-llvm-3e1852fa7ee4a225c1a351bc76752e91a7f18b1f.zip | |
Make sure the types are consistent for a void conditional. No visible
difference, but it's better to be consistent.
llvm-svn: 51961
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 4673ae498fd..8d382485b1d 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -917,15 +917,15 @@ inline QualType Sema::CheckConditionalOperands( // C99 6.5.15 // C99 6.5.15p5: "If both operands have void type, the result has void type." // The following || allows only one side to be void (a GCC-ism). if (lexT->isVoidType() || rexT->isVoidType()) { - if (!lexT->isVoidType()) { + if (!lexT->isVoidType()) Diag(rex->getLocStart(), diag::ext_typecheck_cond_one_void, rex->getSourceRange()); - return rexT.getUnqualifiedType(); - } if (!rexT->isVoidType()) Diag(lex->getLocStart(), diag::ext_typecheck_cond_one_void, lex->getSourceRange()); - return lexT.getUnqualifiedType(); + ImpCastExprToType(lex, Context.VoidTy); + ImpCastExprToType(rex, Context.VoidTy); + return Context.VoidTy; } // C99 6.5.15p6 - "if one operand is a null pointer constant, the result has // the type of the other operand." |

