[cfe-commits] r51065 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/Sema/typecheck-binop.c
Eli Friedman
eli.friedman at gmail.com
Tue May 13 13:16:47 PDT 2008
Author: efriedma
Date: Tue May 13 15:16:47 2008
New Revision: 51065
URL: http://llvm.org/viewvc/llvm-project?rev=51065&view=rev
Log:
Both operands to && have to be scalars, not just one.
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/Sema/typecheck-binop.c
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=51065&r1=51064&r2=51065&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue May 13 15:16:47 2008
@@ -1603,7 +1603,7 @@
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);
}
Modified: cfe/trunk/test/Sema/typecheck-binop.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/typecheck-binop.c?rev=51065&r1=51064&r2=51065&view=diff
==============================================================================
--- cfe/trunk/test/Sema/typecheck-binop.c (original)
+++ cfe/trunk/test/Sema/typecheck-binop.c Tue May 13 15:16:47 2008
@@ -18,3 +18,6 @@
return P-Q; /* expected-warning{{GNU void* extension}} */
}
+int logicaland1(int a) {
+ return a && (void)a; /* expected-error{{invalid operands}} */
+}
More information about the cfe-commits
mailing list