Debian Codegraph @

gcc/testsuite/g++.dg/ext/attr-format3.C

raw
1 // PR c++/101833
2 // { dg-do compile }
3 // { dg-options "-Wall" }
4
5 class Base {};
6
7 struct VDerived : virtual Base {
8 VDerived(int, int, const char *, ...) __attribute__((format(printf, 2, 3))); // { dg-error ".format. attribute argument 2 value .2. refers to parameter type .int." }
9 VDerived(int, const char *, ...) __attribute__((format(printf, 5, 6))); // { dg-warning ".format. attribute argument 2 value .5. exceeds" }
10 } a(1, "%s %d", "foo", 1);
11
12 struct Derived : Base {
13 Derived(int, int, const char *, ...) __attribute__((format(printf, 2, 3))); // { dg-error ".format. attribute argument 2 value .2. refers to parameter type .int." }
14 Derived(int, const char *, ...) __attribute__((format(printf, 5, 6))); // { dg-warning ".format. attribute argument 2 value .5. exceeds" }
15 } b(1, "%s %d", "foo", 1);