diff options
Diffstat (limited to 'clang/test/Sema/format-strings-i386.c')
-rw-r--r-- | clang/test/Sema/format-strings-i386.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/Sema/format-strings-i386.c b/clang/test/Sema/format-strings-i386.c new file mode 100644 index 00000000000..45d10a763ac --- /dev/null +++ b/clang/test/Sema/format-strings-i386.c @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -triple i386-apple-macosx10.7.0 -fsyntax-only -verify -Wformat-nonliteral %s + +int printf(const char *restrict, ...); + +// Test that 'long' is compatible with 'int' on 32-bit. +typedef unsigned int UInt32; +void test_rdar_9763999() { + UInt32 x = 7; + printf("x = %u\n", x); // no-warning +} + +void test_positive() { + printf("%d", "hello"); // expected-warning {{conversion specifies type 'int' but the argument has type 'char *'}} +} + |