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