File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -1035,10 +1035,19 @@ void instantiate() {
10351035 ignoreInstantiations<true >();
10361036 ignoreInstantiations<false >();
10371037}
1038+
10381039void if_with_init_statement () {
10391040 bool x = true ;
10401041 if (bool y = x; y == true ) {
1041- // CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}} : warning: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr]
1042+ // CHECK-MESSAGES: :[[@LINE-1]]:24 : warning: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr]
10421043 // CHECK-FIXES: if (bool y = x; y) {
10431044 }
10441045}
1046+
1047+ void test_init_stmt_true () {
1048+ void foo (int i);
1049+ if (int i = 0 ; true )
1050+ foo (i);
1051+ // CHECK-MESSAGES: :[[@LINE-2]]:18: warning: redundant boolean literal in if statement condition [readability-simplify-boolean-expr]
1052+ // CHECK-FIXES: { int i = 0;foo(i) };
1053+ }
You can’t perform that action at this time.
0 commit comments