================
@@ -75,20 +75,10 @@ void implicitConversionFromBoolInComplexBoolExpressions() {
bool anotherBoolean = false;
int integer = boolean && anotherBoolean;
- // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: implicit conversion 'bool' ->
'int'
- // CHECK-MESSAGES: :[[@LINE-2]]:28: warning: implicit conversion 'bool' ->
'int'
- // CHECK-FIXES: int integer = (int)boolean && (int)anotherBoolean;
-
float floating = (boolean || anotherBoolean) * 0.3f;
- // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: implicit conversion 'bool' ->
'int'
- // CHECK-MESSAGES: :[[@LINE-2]]:32: warning: implicit conversion 'bool' ->
'int'
- // CHECK-FIXES: float floating = ((int)boolean || (int)anotherBoolean) *
0.3f;
-
double doubleFloating = (boolean && (anotherBoolean || boolean)) * 0.3;
// CHECK-MESSAGES: :[[@LINE-1]]:28: warning: implicit conversion 'bool' ->
'int'
- // CHECK-MESSAGES: :[[@LINE-2]]:40: warning: implicit conversion 'bool' ->
'int'
- // CHECK-MESSAGES: :[[@LINE-3]]:58: warning: implicit conversion 'bool' ->
'int'
- // CHECK-FIXES: double doubleFloating = ((int)boolean &&
((int)anotherBoolean || (int)boolean)) * 0.3;
+ // CHECK-FIXES: double doubleFloating = ((int)boolean && (anotherBoolean ||
boolean)) * 0.3;
----------------
zeyi2 wrote:
`(anotherBoolean || boolean)` returns an `int` type result, while `boolean` is
`bool`, so there is an implicit conversion and should get a warning.
https://github.com/llvm/llvm-project/pull/171070
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits