You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: clang-tools-extra/test/clang-tidy/checkers/bugprone/implicit-widening-of-multiplication-result-constants.cpp
+12-3Lines changed: 12 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,11 @@ long t5() {
40
40
return1 * min_int;
41
41
}
42
42
43
+
longt6() {
44
+
constunsignedint a = 4294967295u; // unsigned int max
45
+
return a * 1u;
46
+
}
47
+
43
48
unsignedlongn0() {
44
49
constint a = 1073741824; // 1/2 of int32_t max
45
50
constint b = 3;
@@ -50,7 +55,11 @@ unsigned long n0() {
50
55
// CHECK-MESSAGES: :[[@LINE-4]]:10: note: perform multiplication in a wider type
51
56
}
52
57
53
-
doublen1() {
54
-
constlong a = 100000000;
55
-
return a * 400;
58
+
longn1() {
59
+
constunsignedint a = 4294967295u; // unsigned int max
60
+
return a * 3u;
61
+
// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: performing an implicit widening conversion to type 'long' of a multiplication performed in type 'unsigned int'
62
+
// CHECK-MESSAGES: :[[@LINE-2]]:10: note: make conversion explicit to silence this warning
63
+
// CHECK-MESSAGES: static_cast<long>( )
64
+
// CHECK-MESSAGES: :[[@LINE-4]]:10: note: perform multiplication in a wider type
0 commit comments