aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ext/attr-format-arg1.C
blob: a7ad0f9ca3329ef2d817d6e87f1f7cc8749fc1a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// PR c++/101833
// { dg-do compile }
// { dg-options "-Wall" }

struct B { };

struct V : virtual B {
  const char *fmt (int, const char *) __attribute__((format_arg(3)));
};

struct D : B {
  const char *fmt (int, const char *) __attribute__((format_arg(3)));
};

extern void fmt (const char *, ...) __attribute__((format(printf, 1, 2)));

void
g ()
{
  V v;
  fmt (v.fmt (1, "%d"), 1);
  fmt (v.fmt (1, "%d"), 1lu); // { dg-warning "expects argument of type" }
  D d;
  fmt (d.fmt (1, "%d"), 1);
  fmt (d.fmt (1, "%d"), 1lu); // { dg-warning "expects argument of type" }
}