| 1 |
// { dg-do compile { target c++11_only } } |
| 2 |
// { dg-options "-pedantic" } |
| 3 |
|
| 4 |
class [[deprecated]] A // { dg-bogus "'deprecated' is a C..14 feature" } |
| 5 |
{ |
| 6 |
}; |
| 7 |
|
| 8 |
[[deprecated]] // { dg-bogus "'deprecated' is a C..14 feature" } |
| 9 |
int |
| 10 |
foo(int n) |
| 11 |
{ |
| 12 |
return 42 + n; |
| 13 |
} |
| 14 |
|
| 15 |
class [[deprecated("B has been superceded by C")]] B // { dg-bogus "'deprecated' is a C..14 feature" } |
| 16 |
{ |
| 17 |
}; |
| 18 |
|
| 19 |
[[deprecated("bar is unsafe; use foobar instead")]] // { dg-bogus "'deprecated' is a C..14 feature" } |
| 20 |
int |
| 21 |
bar(int n) |
| 22 |
{ |
| 23 |
return 42 + n - 1; |
| 24 |
} |
| 25 |
|
| 26 |
#if __cplusplus > 201103L |
| 27 |
|
| 28 |
// Deprecate C for C++14 onwards. |
| 29 |
class [[deprecated]] C; |
| 30 |
|
| 31 |
// Deprecate foobar for C++14 onwards. |
| 32 |
[[deprecated]] |
| 33 |
int |
| 34 |
foobar(int n); |
| 35 |
|
| 36 |
#endif |
| 37 |
|
| 38 |
class C |
| 39 |
{ |
| 40 |
}; |
| 41 |
|
| 42 |
int |
| 43 |
foobar(int n) |
| 44 |
{ |
| 45 |
return 43 + n - 1; |
| 46 |
} |
| 47 |
|
| 48 |
int |
| 49 |
main() |
| 50 |
{ |
| 51 |
A aaa; // { dg-warning "is deprecated" } |
| 52 |
int n = foo(12); // { dg-warning "is deprecated" } |
| 53 |
|
| 54 |
B bbb; // { dg-warning "is deprecated" } |
| 55 |
int m = bar(666); // { dg-warning "is deprecated" } |
| 56 |
|
| 57 |
C ccc; // { dg-warning "is deprecated" "" { target { c++14 } } } |
| 58 |
int l = foobar(8); // { dg-warning "is deprecated" "" { target { c++14 } } } |
| 59 |
} |