aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp1y/attr-deprecated.C
blob: 698268a776873f91e3b02d3a4f3c9aa2c1465b82 (plain)
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
// { dg-do compile { target c++1y } }

class [[deprecated]] A
{
};

[[deprecated]]
int
foo(int n)
{
  return 42 + n;
}

class [[deprecated("B has been superceded by C")]] B
{
};

[[deprecated("bar is unsafe; use foobar instead")]]
int
bar(int n)
{
  return 42 + n - 1;
}

#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()
{
  A aaa; // { dg-warning "is deprecated" }
  int n = foo(12); // { dg-warning "is deprecated" }

  B bbb; // { dg-warning "is deprecated" "B has been superceded by C" }
  int m = bar(666); // { dg-warning "is deprecated" "bar is unsafe; use foobar instead" }

  C ccc; // { dg-warning "is deprecated" }
  int l = foobar(8); // { dg-warning "is deprecated" }
}