xbolva00 marked an inline comment as not done. xbolva00 added inline comments.
================ Comment at: clang/test/Sema/warn-bitwise-and-bool.c:21-22 +void test(boolean a, boolean b, int i) { + b = a & b; + b = a & foo(); // expected-warning {{bitwise and of boolean expressions; did you mean logical and?}} + // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:9-[[@LINE-1]]:10}:"&&" ---------------- Quuxplusone wrote: > So the warning triggers only when the RHS has side-effects? I'd like tests for > ``` > foo() & a; // should not trigger, by that logic, because && wouldn't > short-circuit anything? > (p != nullptr) & (*p == 42); // should certainly trigger: deref is a side > effect, and of course obviously this is a bug > ``` Yes, but oh. This is weird, HasSideEffects is false for this case. Works fine for volatile int. @rsmith? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D108003/new/ https://reviews.llvm.org/D108003 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits