| 1 |
// PR c++/79817 - attribute deprecated on namespace. |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
namespace [[deprecated]] ns1 { int i; } |
| 5 |
namespace [[deprecated("foo")]] ns2 { int i; } |
| 6 |
namespace __attribute__((deprecated)) ns3 { int i; } |
| 7 |
namespace __attribute__((deprecated("foo"))) ns4 { int i; } |
| 8 |
|
| 9 |
namespace [[deprecated]] ns6 |
| 10 |
{ |
| 11 |
enum E { X }; |
| 12 |
void fn(); |
| 13 |
} |
| 14 |
|
| 15 |
namespace [[deprecated]] ns7 |
| 16 |
{ |
| 17 |
namespace ns8 { |
| 18 |
int x; |
| 19 |
struct Z { }; |
| 20 |
} |
| 21 |
struct S { }; |
| 22 |
} |
| 23 |
|
| 24 |
namespace N1 |
| 25 |
{ |
| 26 |
namespace N2 |
| 27 |
{ |
| 28 |
namespace [[deprecated]] N3 |
| 29 |
{ |
| 30 |
namespace N4 { int x; } |
| 31 |
} |
| 32 |
} |
| 33 |
} |
| 34 |
|
| 35 |
void |
| 36 |
f () |
| 37 |
{ |
| 38 |
ns1::i = 0; // { dg-warning ".ns1. is deprecated" } |
| 39 |
ns2::i = 0; // { dg-warning ".ns2. is deprecated: foo" } |
| 40 |
ns3::i = 0; // { dg-warning ".ns3. is deprecated" } |
| 41 |
ns4::i = 0; // { dg-warning ".ns4. is deprecated" } |
| 42 |
int i = ns1::i; // { dg-warning ".ns1. is deprecated" } |
| 43 |
int k = ns6::E::X; // { dg-warning ".ns6. is deprecated" } |
| 44 |
ns7::ns8::x = 42; // { dg-warning ".ns7. is deprecated" } |
| 45 |
N1::N2::N3::N4::x = 42; // { dg-warning ".N1::N2::N3. is deprecated" } |
| 46 |
ns6::fn(); // { dg-warning ".ns6. is deprecated" } |
| 47 |
ns7::S s; // { dg-warning ".ns7. is deprecated" } |
| 48 |
ns7::S sfn(int); // { dg-warning ".ns7. is deprecated" } |
| 49 |
ns7::ns8::Z sfn2(int); // { dg-warning ".ns7. is deprecated" } |
| 50 |
} |