Quuxplusone added inline comments.

Comment at: test/CXX/expr/expr.unary/expr.unary.op/p6.cpp:18
 // --  pointer, 
 bool b6 = !&b4; // expected-warning{{address of 'b4' will always evaluate to 
+// expected-warning@-1 {{comparing 'bool *' as a boolean}}
This is not "comparing" anything, so the warning seems inappropriate here. 
Maybe "implicitly converting 'bool *' to 'bool' in operand of '!'` would be 
more appropriate?

Please add test cases for `operator!`, `operator&&`, `operator||`, and 

Comment at: test/Sema/static-init.c:10
 intptr_t s = (intptr_t) &s;
-_Bool t = &t;
+_Bool t = &t; // expected-warning {{comparing '_Bool *' as a boolean}}
Again, not "comparing" anything.
Incidentally, do you know why this line fails to produce an "address of 't' 
will always evaluate to 'true'" warning?

Comment at: test/SemaCXX/warn-bool-ptr-to-bool.cpp:5
+  if (b)
+    // expected-warning@-1 {{comparing 'bool *' as a boolean}}
+    return 10;
Please add a test case

template<class T>
T foo(T *ptr) {
    return ptr ? *ptr : T{};
bool bar(bool *ptr) { return foo(ptr); }

and make sure the warning does not trigger in this case. (It would be OK to 
trigger a clang-tidy check in this case, but IMHO not a `-W -Wall -Wextra` 


cfe-commits mailing list

Reply via email to