1 // RUN: %clang_cc1 -std=c++1y -verify %s
3 class [[deprecated
]] C
{}; // expected-note {{'C' has been explicitly marked deprecated here}}
4 C c
; // expected-warning {{'C' is deprecated}}
6 typedef int t
[[deprecated
]]; // expected-note {{'t' has been explicitly marked deprecated here}}
7 t x
= 42; // expected-warning {{'t' is deprecated}}
9 [[deprecated
]] int old
= 42; // expected-note {{'old' has been explicitly marked deprecated here}}
10 int use
= old
; // expected-warning {{'old' is deprecated}}
12 struct S
{ [[deprecated
]] int member
= 42; } s
; // expected-note {{'member' has been explicitly marked deprecated here}}
13 int use2
= s
.member
; // expected-warning {{'member' is deprecated}}
15 [[deprecated
]] int f() { return 42; } // expected-note {{'f' has been explicitly marked deprecated here}}
16 int use3
= f(); // expected-warning {{'f' is deprecated}}
18 enum [[deprecated
]] e
{ E
}; // expected-note {{'e' has been explicitly marked deprecated here}}
19 e my_enum
; // expected-warning {{'e' is deprecated}}
21 template <typename T
> class X
{};
22 template <> class [[deprecated
]] X
<int> {}; // expected-note {{'X<int>' has been explicitly marked deprecated here}}
24 X
<int> x2
; // expected-warning {{'X<int>' is deprecated}}
26 template <typename T
> class [[deprecated
]] X2
{}; //expected-note {{'X2<char>' has been explicitly marked deprecated here}}
27 template <> class X2
<int> {};
28 X2
<char> x3
; // expected-warning {{'X2<char>' is deprecated}}
29 X2
<int> x4
; // No warning, the specialization removes it.
31 template <typename T
> class [[deprecated
]] X3
; //expected-note {{'X3<char>' has been explicitly marked deprecated here}}
32 template <> class X3
<int>;
33 X3
<char> *x5
; // expected-warning {{'X3<char>' is deprecated}}
34 X3
<int> *x6
; // No warning, the specialization removes it.
36 template <typename T
> struct A
;
38 template <typename T
> struct [[deprecated
]] A
;//expected-note {{'A<int>' has been explicitly marked deprecated here}} expected-note {{'A<float>' has been explicitly marked deprecated here}}
39 A
<int> *q
; // expected-warning {{'A<int>' is deprecated}}
40 A
<float> *r
; // expected-warning {{'A<float>' is deprecated}}
42 template <typename T
> struct B
;
44 template <typename T
> struct [[deprecated
]] B
;//expected-note {{'B<int>' has been explicitly marked deprecated here}} expected-note {{'B<float>' has been explicitly marked deprecated here}}
45 B
<int> *q2
; // expected-warning {{'B<int>' is deprecated}}
46 B
<float> *r2
; // expected-warning {{'B<float>' is deprecated}}
50 struct [[deprecated
]] FunS
{}; // expected-note {{'FunS' has been explicitly marked deprecated here}}
51 FunS f
;// expected-warning {{'FunS' is deprecated}}
56 [[deprecated
]]T
some_func2(T t
) {
58 FunS2 f
;// No warning, entire function is deprecated, so usage here should be fine.