-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathattributes.cpp
108 lines (81 loc) · 1.75 KB
/
attributes.cpp
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// $HOME/bin/bin/g++ -std=c++1z -pedantic -o attributes attributes.cpp
// $HOME/bin_binio/bin/g++ -std=c++1z -o attributes attributes.cpp
// $HOME/bin_binio/bin/g++ -std=c++14 -o attributes attributes.cpp
// $HOME/bin_binio/bin/g++ -std=c++14 -pedantic -o attributes attributes.cpp
// $HOME/bin_biniold/bin/g++ -std=c++14 -o attributes attributes.cpp
// $HOME/bin_biniold/bin/g++ -std=c++14 -pedantic -o attributes attributes.cpp
enum class Planets
{
Mercury,
Venus,
Earth,
Mars,
Jupiter,
Saturn,
Uranus [[deprecated("We'll stop those jokes once and for all!")]],
Urectum = Uranus,
Neptune,
Pluto [[removed("Pluto - the first of the minor planets!")]]
};
enum Colors
{
Red,
Green,
Mauve [[deprecated("Mauve is not a real color.")]],
Blue
};
class C
{
public:
enum Foo
{
T,
U [[deprecated("unused")]],
V
};
};
template<typename Tp>
class D
{
public:
enum Bar
{
X,
Y [[deprecated("unused")]],
Z
};
};
namespace poo [[gnu::visibility("default")]]
{
int num_iters;
Planets hot = Planets::Mercury;
Planets favorite = Planets::Uranus;
Planets poor_pluto = Planets::Pluto;
int i = Mauve;
auto j = C::U; // { dg-warning ".C::U. is deprecated" }
auto k = D<int>::Y; // { dg-warning ".D<int>::Y. is deprecated" }
}
namespace bah [[deprecated("unstable function")]]
{
double bessel_j0(double x) { return 0.0; }
double bessel_j1(double x) { return 0.0; }
double bessel_j(int n, double x) { return 0.0; }
}
namespace baz
{
inline namespace boo [[deprecated("inappropriate function")]]
{
int poop(int x) { return 0; }
}
}
namespace// [[deprecated("unnecessary function")]]
{
void init();
}
int
main()
{
bah::bessel_j0(1.5);
baz::boo::poop(5);
baz::poop(2);
}