summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/attributes-namespace1.C
blob: d49ebb0b7210d03c0d6d01695688dc22ff7df2bf (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
// PR c++/79817 - attribute deprecated on namespace.
// { dg-do compile { target c++11 } }

namespace [[deprecated]] ns1 { int i; }
namespace [[deprecated("foo")]] ns2 { int i; }
namespace __attribute__((deprecated)) ns3 { int i; }
namespace __attribute__((deprecated("foo"))) ns4 { int i; }

namespace [[deprecated]] ns6
{
  enum E { X };
  void fn();
}

namespace [[deprecated]] ns7
{
  namespace ns8 {
    int x;
    struct Z { };
  }
  struct S { };
}

namespace N1
{
  namespace N2
  {
    namespace [[deprecated]] N3
    {
      namespace N4 { int x; }
    }
  }
}

void
f ()
{
  ns1::i = 0; // { dg-warning ".ns1. is deprecated" }
  ns2::i = 0; // { dg-warning ".ns2. is deprecated: foo" }
  ns3::i = 0; // { dg-warning ".ns3. is deprecated" }
  ns4::i = 0; // { dg-warning ".ns4. is deprecated" }
  int i = ns1::i; // { dg-warning ".ns1. is deprecated" }
  int k = ns6::E::X;  // { dg-warning ".ns6. is deprecated" }
  ns7::ns8::x = 42; // { dg-warning ".ns7. is deprecated" }
  N1::N2::N3::N4::x = 42; // { dg-warning ".N1::N2::N3. is deprecated" }
  ns6::fn(); // { dg-warning ".ns6. is deprecated" }
  ns7::S s; // { dg-warning ".ns7. is deprecated" }
  ns7::S sfn(int); // { dg-warning ".ns7. is deprecated" }
  ns7::ns8::Z sfn2(int); // { dg-warning ".ns7. is deprecated" }
}