================
@@ -1035,3 +1035,19 @@ void instantiate() {
   ignoreInstantiations<true>();
   ignoreInstantiations<false>();
 }
+
+void if_with_init_statement() {
+  bool x = true;
+  if (bool y = x; y == true) {
+    // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: redundant boolean literal 
supplied to boolean operator [readability-simplify-boolean-expr]
+    // CHECK-FIXES: if (bool y = x; y) {
+  }
----------------
vbvictor wrote:

Can we add this test without braces?
We should not add braces if there are no existing braces.
There is currently no check to remove braces - so stripping them manually would 
be painful.

https://github.com/llvm/llvm-project/pull/172220
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to