firewave wrote: Some thoughts based on the warnings I am seeing in actual code.
--- Another way to fix this could be using `std::to_string()`. --- I am seeing this with an enum type which might be valid, working code but have not looked into it yet. --- The fix-it is problematic if it is a templated type and should probably be omitted in that case: ``` #include <cstdint> #include <sstream> template<typename T> void func(const T& data) { std::ostringstream ostr; ostr << data; } void f() { func((char)0); func((int8_t)0); func(""); } ``` ``` <source>:8:10: warning: 'signed char' passed to 'operator<<' outputs as character instead of integer. cast to 'unsigned int' to print numeric value or cast to 'char' to print as character [bugprone-unintended-char-ostream-output] 8 | ostr << data; | ^ ~~~~ | static_cast<int>(data) ``` https://godbolt.org/z/93axK1E4M https://github.com/llvm/llvm-project/pull/127720 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits