Debian Codegraph @

gcc/testsuite/g++.dg/warn/Wformat-3.C

raw
1 // PR c++/116954
2 // { dg-additional-options -Wformat }
3
4 #ifndef WORKS
5 template<int N>
6 int fn(char (&buf)[N], const char fmt[], ...)
7 __attribute__ ((__format__ (__printf__, 2, 3)));
8 #endif
9
10 template<int N>
11 __attribute__ ((__format__ (__printf__, 2, 3)))
12 int fn(char (&)[N], const char [], ...)
13 { return 0; }
14
15 int main()
16 {
17 char buf[20];
18 return fn(buf, "%s", 42); /* { dg-warning "Wformat" } */
19 }