brintos

brintos / llvm-project-archived public Read only

0
0
Text · 986 B · d824ea3 Raw
16 lines · cpp
1// RUN: %check_clang_tidy -std=c99 %s bugprone-implicit-widening-of-multiplication-result %t -- -- -target x86_64-unknown-unknown -x c2// RUN: %check_clang_tidy %s bugprone-implicit-widening-of-multiplication-result %t -- -- -target x86_64-unknown-unknown -x c++3 4long 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 warning8  // CHECK-NOTES: :[[@LINE-3]]:10: note: perform multiplication in a wider type9}10long 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 warning14  // CHECK-NOTES: :[[@LINE-3]]:10: note: perform multiplication in a wider type15}16