================ @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -fsyntax-only -Wshift-bool -verify %s + +void t() { + int x = 10; + bool y = true; + + bool a = y >> x; // expected-warning {{right shifting a `bool` implicitly converts it to 'int'}} + bool b = false >> x; // expected-warning {{right shifting a `bool` implicitly converts it to 'int'}} + bool c = y >> 5; // expected-warning {{right shifting a `bool` implicitly converts it to 'int'}} + bool d = y >> -1; // expected-warning {{right shifting a `bool` implicitly converts it to 'int'}} + bool e = y >> 0; // expected-warning {{right shifting a `bool` implicitly converts it to 'int'}} ---------------- Fznamznon wrote:
Can we also check that clang doesn't warn on left shift? Can we also add a test checking something like ``` if ((y >> 2) != 7) // expected-warning ``` https://github.com/llvm/llvm-project/pull/127336 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits