blob: 56b20b1b7b73f0c65edfb6446c20a9c587f51b80 [file] [log] [blame]
Hans Wennborg29e97cb2011-10-27 08:29:09 +00001// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify %s
2
3int printf(char const *, ...);
4
5void test(void) {
6 // size_t
Hans Wennborga792aff2011-12-07 10:33:11 +00007 printf("%zu", (double)42); // expected-warning {{conversion specifies type 'size_t' (aka 'unsigned long') but the argument has type 'double''}}
Hans Wennborg29e97cb2011-10-27 08:29:09 +00008
9 // intmax_t / uintmax_t
Hans Wennborga792aff2011-12-07 10:33:11 +000010 printf("%jd", (double)42); // expected-warning {{conversion specifies type 'intmax_t' (aka 'long') but the argument has type 'double''}}
11 printf("%ju", (double)42); // expected-warning {{conversion specifies type 'uintmax_t' (aka 'unsigned long') but the argument has type 'double''}}
Hans Wennborg29e97cb2011-10-27 08:29:09 +000012
13 // ptrdiff_t
Hans Wennborga792aff2011-12-07 10:33:11 +000014 printf("%td", (double)42); // expected-warning {{conversion specifies type 'ptrdiff_t' (aka 'long') but the argument has type 'double''}}
Hans Wennborg29e97cb2011-10-27 08:29:09 +000015}