diff options
Diffstat (limited to 'clang/test/Sema/format-strings-pedantic.c')
| -rw-r--r-- | clang/test/Sema/format-strings-pedantic.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/Sema/format-strings-pedantic.c b/clang/test/Sema/format-strings-pedantic.c new file mode 100644 index 00000000000..8fb298ab799 --- /dev/null +++ b/clang/test/Sema/format-strings-pedantic.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Wformat -Wformat-pedantic -isystem %S/Inputs %s + +int printf(const char *restrict, ...); + +typedef unsigned char uint8_t; + +void print_char_as_short() { + printf("%hu\n", (unsigned char)1); // expected-warning{{format specifies type 'unsigned short' but the argument has type 'unsigned char'}} + printf("%hu\n", (uint8_t)1); // expected-warning{{format specifies type 'unsigned short' but the argument has type 'uint8_t' (aka 'unsigned char')}} +} |

