| 1 |
// PR c++/101833 |
| 2 |
// { dg-do compile } |
| 3 |
// { dg-options "-Wall" } |
| 4 |
|
| 5 |
struct B { }; |
| 6 |
|
| 7 |
struct V : virtual B { |
| 8 |
const char *fmt (int, const char *) __attribute__((format_arg(3))); |
| 9 |
}; |
| 10 |
|
| 11 |
struct D : B { |
| 12 |
const char *fmt (int, const char *) __attribute__((format_arg(3))); |
| 13 |
}; |
| 14 |
|
| 15 |
extern void fmt (const char *, ...) __attribute__((format(printf, 1, 2))); |
| 16 |
|
| 17 |
void |
| 18 |
g () |
| 19 |
{ |
| 20 |
V v; |
| 21 |
fmt (v.fmt (1, "%d"), 1); |
| 22 |
fmt (v.fmt (1, "%d"), 1lu); // { dg-warning "expects argument of type" } |
| 23 |
D d; |
| 24 |
fmt (d.fmt (1, "%d"), 1); |
| 25 |
fmt (d.fmt (1, "%d"), 1lu); // { dg-warning "expects argument of type" } |
| 26 |
} |