gcc/testsuite/g++.dg/warn/pr117825.C
raw| 1 | // PR c++/117825 |
| 2 | // { dg-do compile { target c++17 } } |
| 3 | // { dg-options "-Wformat -Wformat-security" } |
| 4 | |
| 5 | __attribute__((format (printf, 1, 2))) |
| 6 | int fails (const char *, ...) { return 0; } |
| 7 | |
| 8 | template <auto func, typename... Args> |
| 9 | auto wrap (Args... args) -> decltype (func (args...)) |
| 10 | { |
| 11 | return func (args...); // { dg-warning "format not a string literal and no format arguments" } |
| 12 | } |
| 13 | |
| 14 | int |
| 15 | main () |
| 16 | { |
| 17 | wrap<fails> ("Test!"); |
| 18 | } |