1 // RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral -pedantic %s
6 extern int scanf(const char *restrict, ...);
7 extern int printf(const char *restrict, ...);
8 extern int vprintf(const char *restrict, va_list);
14 + (void)print:(NSString *)format, ... __attribute__((format(NSString, 1, 2)));
20 void my_uninstantiated_print(const T &arg) {
21 [Format print:@"%d", arg];
25 void my_print(const T &arg) {
26 [Format print:@"%d", arg]; // expected-warning {{format specifies type 'int' but the argument has type 'const char *'}}
30 my_print("abc"); // expected-note {{requested here}}
35 class UninstantiatedPrinter {
37 static void print(const T &arg) {
38 [Format print:@"%d", arg]; // no-warning
45 void print(const T &arg) {
46 [Format print:@"%d", arg]; // expected-warning {{format specifies type 'int' but the argument has type 'const char *'}}
50 void use_class(Printer<const char *> &p) {
51 p.print("abc"); // expected-note {{requested here}}
56 class UninstantiatedWrapper {
60 void print(const T &arg) {
61 [Format print:@"%d", arg]; // no-warning
71 void print(const T &arg) {
72 [Format print:@"%d", arg]; // expected-warning {{format specifies type 'int' but the argument has type 'const char *'}}
77 void use_class(Wrapper<const char *>::Printer &p) {
78 p.print("abc"); // expected-note {{requested here}}