1 // https://clang.llvm.org/extra/clang-tidy/checks/bugprone-string-integer-assignment.html
2 
3 #include "structures.h"
4 
test_int()5 void test_int()
6 {
7   // Numeric types can be implicitly casted to character types.
8   std::string s;
9   int x = 5965;
10   s = 6; // warning
11   s = x; // warning
12 }
13 
test_conversion()14 void test_conversion()
15 {
16   // Use the appropriate conversion functions or character literals.
17   std::string s;
18   int x = 5965;
19   s = '6'; // OK
20   s = std::to_string(x); // OK
21 }
22 
test_cast()23 void test_cast()
24 {
25   // In order to suppress false positives, use an explicit cast.
26   std::string s;
27   s = static_cast<char>(6); // OK
28 }
29