49 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s2 3namespace [[deprecated]] {} // expected-warning {{'deprecated' attribute on anonymous namespace ignored}}4 5namespace [[deprecated]] N { // expected-note 4{{'N' has been explicitly marked deprecated here}}6 int X;7 int Y = X; // Ok8 int f();9}10 11int N::f() { // Ok12 return Y; // Ok13}14 15void f() {16 int Y = N::f(); // expected-warning {{'N' is deprecated}}17 using N::X; // expected-warning {{'N' is deprecated}}18 int Z = X; //Ok19}20 21void g() {22 using namespace N; // expected-warning {{'N' is deprecated}}23 int Z = Y; // Ok24}25 26namespace M = N; // expected-warning {{'N' is deprecated}}27 28// Shouldn't diag:29[[nodiscard, deprecated("")]] int PR37935();30 31namespace cxx20_concept {32template <typename>33concept C __attribute__((deprecated)) = true; // #C34 35template <C T>36// expected-warning@-1 {{'C' is deprecated}}37// expected-note@#C {{'C' has been explicitly marked deprecated here}}38void f();39 40namespace GH98164 {41template <int>42auto b() = delete; // #b43 44decltype(b<0>()) x;45// expected-error@-1 {{call to deleted function 'b'}}46// expected-note@#b {{candidate function [with $0 = 0] has been explicitly deleted}}47} // namespace GH9816448} // namespace cxx20_concept49