Debian Codegraph @

gcc/testsuite/g++.dg/warn/deprecated-19.C

raw
1 // PR c++/116636
2 // { dg-do compile }
3 // { dg-options "-pedantic -Wdeprecated" }
4
5 struct A {
6 virtual int foo () = 0;
7 };
8 struct B : virtual A {
9 [[deprecated]] int foo () { return 0; } // { dg-message "declared here" }
10 }; // { dg-warning "C\\\+\\\+11 attributes only available with" "" { target c++98_only } .-1 }
11 struct C : virtual A {
12 [[gnu::unavailable]] int foo () { return 0; } // { dg-message "declared here" }
13 }; // { dg-warning "C\\\+\\\+11 attributes only available with" "" { target c++98_only } .-1 }
14
15 void
16 bar ()
17 {
18 B b;
19 b.foo (); // { dg-warning "'virtual int B::foo\\\(\\\)' is deprecated" }
20 C c;
21 c.foo (); // { dg-error "'virtual int C::foo\\\(\\\)' is unavailable" }
22 }