aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp1y/attr-deprecated-neg.C
blob: 134b3b89c0294e0b0548b8a43ebc60332bdc22ed (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++11_only } }

class [[deprecated]] A // { dg-warning "attribute directive ignored" }
{
};

[[deprecated]]
int
foo(int n) // { dg-warning "attribute directive ignored" }
{
  return 42 + n;
}

class [[deprecated("B has been superceded by C")]] B // { dg-warning "attribute directive ignored" }
{
};

[[deprecated("bar is unsafe; use foobar instead")]]
int
bar(int n) // { dg-warning "attribute directive ignored" }
{
  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;
  int n = foo(12);

  B bbb;
  int m = bar(666);

  C ccc;
  int l = foobar(8);
}