| 1 | // RUN: %check_clang_tidy -std=c99 %s bugprone-implicit-widening-of-multiplication-result %t -- -- -target x86_64-unknown-unknown -x c |
| 2 | // RUN: %check_clang_tidy %s bugprone-implicit-widening-of-multiplication-result %t -- -- -target x86_64-unknown-unknown -x c++ |
| 3 | |
| 4 | long t0(short a, int b) { |
| 5 | return a * b; |
| 6 | // CHECK-NOTES: :[[@LINE-1]]:10: warning: performing an implicit widening conversion to type 'long' of a multiplication performed in type 'int' |
| 7 | // CHECK-NOTES: :[[@LINE-2]]:10: note: make conversion explicit to silence this warning |
| 8 | // CHECK-NOTES: :[[@LINE-3]]:10: note: perform multiplication in a wider type |
| 9 | } |
| 10 | long t1(short a, short b) { |
| 11 | return a * b; |
| 12 | // CHECK-NOTES: :[[@LINE-1]]:10: warning: performing an implicit widening conversion to type 'long' of a multiplication performed in type 'int' |
| 13 | // CHECK-NOTES: :[[@LINE-2]]:10: note: make conversion explicit to silence this warning |
| 14 | // CHECK-NOTES: :[[@LINE-3]]:10: note: perform multiplication in a wider type |
| 15 | } |
| 16 | |