summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp2
-rw-r--r--clang/test/Sema/typecheck-binop.c3
2 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 68a3f8d5936..4567d82719f 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -1603,7 +1603,7 @@ inline QualType Sema::CheckLogicalOperands( // C99 6.5.[13,14]
UsualUnaryConversions(lex);
UsualUnaryConversions(rex);
- if (lex->getType()->isScalarType() || rex->getType()->isScalarType())
+ if (lex->getType()->isScalarType() && rex->getType()->isScalarType())
return Context.IntTy;
return InvalidOperands(loc, lex, rex);
}
diff --git a/clang/test/Sema/typecheck-binop.c b/clang/test/Sema/typecheck-binop.c
index 05b9ad9067e..8367565de2e 100644
--- a/clang/test/Sema/typecheck-binop.c
+++ b/clang/test/Sema/typecheck-binop.c
@@ -18,3 +18,6 @@ int sub4(void *P, void *Q) {
return P-Q; /* expected-warning{{GNU void* extension}} */
}
+int logicaland1(int a) {
+ return a && (void)a; /* expected-error{{invalid operands}} */
+}
OpenPOWER on IntegriCloud