1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -verify %s
2 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -x c++ -verify %s
3 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -x c++ -std=c++11 -verify %s
4 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -x objective-c -verify %s
5 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -x objective-c++ -std=c++11 -verify %s
8 # define EXTERN_C extern "C"
10 # define EXTERN_C extern
13 EXTERN_C int printf(const char *,...);
15 typedef enum { Constant = 0 } TestEnum;
16 // Note that in C, the type of 'Constant' is 'int'. In C++ it is 'TestEnum'.
17 // This is why we don't check for that in the expected output.
19 void test(TestEnum input) {
20 printf("%d", input); // no-warning
21 printf("%d", Constant); // no-warning
23 printf("%lld", input); // expected-warning-re{{format specifies type 'long long' but the argument has underlying type '{{(unsigned)?}} int'}}
24 printf("%lld", Constant); // expected-warning{{format specifies type 'long long'}}
28 typedef enum { LongConstant = ~0UL } LongEnum;
30 void testLong(LongEnum input) {
31 printf("%u", input); // expected-warning{{format specifies type 'unsigned int' but the argument has underlying type}}
32 printf("%u", LongConstant); // expected-warning{{format specifies type 'unsigned int'}}
35 printf("%lu", LongConstant);