Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: %check_clang_tidy %s bugprone-unintended-char-ostream-output %t -- \
// RUN: -config="{CheckOptions: \
// RUN: {bugprone-unintended-char-ostream-output.CastTypeName: "uint8_t"}}"
// RUN: {bugprone-unintended-char-ostream-output.CastTypeName: \"unsigned char\"}}"

namespace std {

Expand Down Expand Up @@ -33,12 +33,12 @@ void origin_ostream(std::ostream &os) {
unsigned char unsigned_value = 9;
os << unsigned_value;
// CHECK-MESSAGES: [[@LINE-1]]:6: warning: 'unsigned char' passed to 'operator<<' outputs as character instead of integer
// CHECK-FIXES: os << static_cast<uint8_t>(unsigned_value);
// CHECK-FIXES: os << static_cast<unsigned char>(unsigned_value);

signed char signed_value = 9;
os << signed_value;
// CHECK-MESSAGES: [[@LINE-1]]:6: warning: 'signed char' passed to 'operator<<' outputs as character instead of integer
// CHECK-FIXES: os << static_cast<uint8_t>(signed_value);
// CHECK-FIXES: os << static_cast<unsigned char>(signed_value);

char char_value = 9;
os << char_value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void based_on_ostream(A &os) {
os << char_value;
}

void based_on_ostream(std::basic_ostream<unsigned char> &os) {
void other_ostream_template_parameters(std::basic_ostream<unsigned char> &os) {
unsigned char unsigned_value = 9;
os << unsigned_value;

Expand Down
Loading