-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeprecated.cpp
More file actions
71 lines (55 loc) · 792 Bytes
/
deprecated.cpp
File metadata and controls
71 lines (55 loc) · 792 Bytes
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// $HOME/bin/bin/g++ -std=c++14 -o deprecated_cxx14 deprecated.cpp
// $HOME/bin/bin/g++ -std=c++11 -o deprecated_cxx11 deprecated.cpp
class [[gnu::deprecated]] gA
{
};
[[gnu::deprecated]]
int
gfoo(int n)
{
return 42 + n;
}
class [[deprecated]] A
{
};
[[deprecated]]
int
foo(int n)
{
return 42 + n;
}
class [[deprecated("A has been superceded by B")]] B
{
};
[[deprecated("bar is unsafe; use poobar instead")]]
int
bar(int n)
{
return 42 + n;
}
#if __cplusplus > 201103L
// Deprecate C for C++14 onwards.
class [[deprecated]] C;
// Deprecate foobar for C++14 onwards.
[[deprecated]]
int
foobar(int n);
#endif
class C
{
};
int
foobar(int n)
{
return 43 + n - 1;
}
int
main()
{
gA gaaa;
int gn = gfoo(12);
A aaa;
int n = foo(12);
B bbb;
int m = bar(666);
}