[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / SemaCXX / cxx-deprecated.cpp
blobaa4501d53197a75286ed59289d27cf62769670ad
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++1z %s
3 namespace [[deprecated]] {} // expected-warning {{'deprecated' attribute on anonymous namespace ignored}}
5 namespace [[deprecated]] N { // expected-note 4{{'N' has been explicitly marked deprecated here}}
6 int X;
7 int Y = X; // Ok
8 int f();
11 int N::f() { // Ok
12 return Y; // Ok
15 void f() {
16 int Y = N::f(); // expected-warning {{'N' is deprecated}}
17 using N::X; // expected-warning {{'N' is deprecated}}
18 int Z = X; //Ok
21 void g() {
22 using namespace N; // expected-warning {{'N' is deprecated}}
23 int Z = Y; // Ok
26 namespace M = N; // expected-warning {{'N' is deprecated}}
28 // Shouldn't diag:
29 [[nodiscard, deprecated("")]] int PR37935();