summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/format-strings.c
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Sema/format-strings.c')
-rw-r--r--clang/test/Sema/format-strings.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/test/Sema/format-strings.c b/clang/test/Sema/format-strings.c
index 35210c341a5..83f96ff3a00 100644
--- a/clang/test/Sema/format-strings.c
+++ b/clang/test/Sema/format-strings.c
@@ -363,3 +363,12 @@ int printf(const char * restrict, ...) __attribute__((__format__ (__printf__, 1,
void rdar9612060(void) {
printf("%s", 2); // expected-warning{{conversion specifies type 'char *' but the argument has type 'int'}}
}
+
+void check_char(unsigned char x, signed char y) {
+ printf("%c", y); // no-warning
+ printf("%hhu", x); // no-warning
+ printf("%hhi", y); // no-warning
+ printf("%hhi", x); // expected-warning{{conversion specifies type 'signed char' but the argument has type 'unsigned char'}}
+ printf("%c", x); // no-warning
+ printf("%hhu", y); // expected-warning{{conversion specifies type 'unsigned char' but the argument has type 'signed char'}}
+}
OpenPOWER on IntegriCloud