1 // RUN: %clang_cc1 %s -verify -fexceptions
3 void f() __attribute__((deprecated
)); // expected-note 2 {{'f' has been explicitly marked deprecated here}}
5 void h(A
* a
) __attribute__((deprecated
));
7 int b
__attribute__((deprecated
)); // expected-note 2 {{'b' has been explicitly marked deprecated here}}
12 f(); // expected-warning{{'f' is deprecated}}
13 a
->f(); // expected-warning{{'f' is deprecated}}
15 (void)b
; // expected-warning{{'b' is deprecated}}
16 (void)a
->b
; // expected-warning{{'b' is deprecated}}
29 virtual void f() __attribute__((deprecated
)); // expected-note 6 {{'f' has been explicitly marked deprecated here}}
34 f(); // expected-warning{{'f' is deprecated}}
35 B::f(); // expected-warning{{'f' is deprecated}}
46 B::f(); // expected-warning{{'f' is deprecated}}
50 b
->f(); // expected-warning{{'f' is deprecated}}
51 b
->B::f(); // expected-warning{{'f' is deprecated}}
55 c
->B::f(); // expected-warning{{'f' is deprecated}}
59 virtual void f() __attribute__((deprecated
));// expected-note{{'f' has been explicitly marked deprecated here}}
60 virtual void f(int) __attribute__((deprecated
));// expected-note{{'f' has been explicitly marked deprecated here}}
61 virtual void f(int, int) __attribute__((deprecated
));// expected-note{{'f' has been explicitly marked deprecated here}}
66 void D::f(int v1
, int v2
) { }
69 d
->f(); // expected-warning{{'f' is deprecated}}
70 d
->f(42); // expected-warning{{'f' is deprecated}}
71 d
->f(42, 24); // expected-warning{{'f' is deprecated}}
75 // Overloaded namespace members.
77 void foo(int) __attribute__((deprecated
)); // expected-note {{'foo' has been explicitly marked deprecated here}}
78 void test1() { foo(10); } // expected-warning {{deprecated}}
79 void foo(short) __attribute__((deprecated
)); // expected-note {{'foo' has been explicitly marked deprecated here}}
80 void test2(short s
) { foo(s
); } // expected-warning {{deprecated}}
82 void test3(long l
) { foo(l
); }
84 friend void foo(A
*) __attribute__((deprecated
)); // expected-note {{'foo' has been explicitly marked deprecated here}}
86 void test4(A
*a
) { foo(a
); } // expected-warning {{deprecated}}
90 void foo(const Foo
&f
) __attribute__((deprecated
)); // expected-note {{'foo' has been explicitly marked deprecated here}}
93 foo(ns::Foo()); // expected-warning {{deprecated}}
97 // Overloaded class members.
100 void foo(int) __attribute__((deprecated
)); // expected-note 2 {{'foo' has been explicitly marked deprecated here}}
102 static void bar(int) __attribute__((deprecated
)); // expected-note 3 {{'bar' has been explicitly marked deprecated here}}
103 static void bar(long);
105 void test2(int i
, long l
);
107 void test1(int i
, long l
) {
109 a
.foo(i
); // expected-warning {{deprecated}}
111 a
.bar(i
); // expected-warning {{deprecated}}
113 A::bar(i
); // expected-warning {{deprecated}}
117 void A::test2(int i
, long l
) {
118 foo(i
); // expected-warning {{deprecated}}
120 bar(i
); // expected-warning {{deprecated}}
125 // Overloaded operators.
128 void operator*(const A
&);
129 void operator*(int) __attribute__((deprecated
)); // expected-note {{'operator*' has been explicitly marked deprecated here}}
130 void operator-(const A
&) const;
132 void operator+(const A
&, const A
&);
133 void operator+(const A
&, int) __attribute__((deprecated
)); // expected-note {{'operator+' has been explicitly marked deprecated here}}
134 void operator-(const A
&, int) __attribute__((deprecated
)); // expected-note {{'operator-' has been explicitly marked deprecated here}}
139 a
+ 1; // expected-warning {{deprecated}}
141 a
- 1; // expected-warning {{deprecated}}
143 a
* 1; // expected-warning {{deprecated}}
147 // Overloaded operator call.
150 typedef void (*intfn
)(int);
151 typedef void (*unintfn
)(unsigned);
152 operator intfn() __attribute__((deprecated
)); // expected-note {{'operator void (*)(int)' has been explicitly marked deprecated here}}
154 void operator ()(A
&) __attribute__((deprecated
)); // expected-note {{'operator()' has been explicitly marked deprecated here}}
155 void operator ()(const A
&);
160 a(1); // expected-warning {{deprecated}}
165 a(b
); // expected-warning {{deprecated}}
172 operator int() __attribute__((deprecated
)); // expected-note 3 {{'operator int' has been explicitly marked deprecated here}}
176 int i
= a
; // expected-warning {{deprecated}}
185 foo(a
); // expected-warning {{deprecated}}
194 myInt(a
), // expected-warning {{deprecated}}
200 // rdar://problem/8518751
202 enum __attribute__((deprecated
)) A
{ // expected-note 2 {{'A' has been explicitly marked deprecated here}}
206 A x
; // expected-warning {{'A' is deprecated}}
207 x
= a0
; // expected-warning {{'a0' is deprecated}}
211 b0
__attribute__((deprecated
)), // expected-note {{'b0' has been explicitly marked deprecated here}}
216 x
= b0
; // expected-warning {{'b0' is deprecated}}
220 template <class T
> struct C
{
221 enum __attribute__((deprecated
)) Enum
{ // expected-note 2 {{'Enum' has been explicitly marked deprecated here}}
226 C
<int>::Enum x
; // expected-warning {{'Enum' is deprecated}}
227 x
= C
<int>::c0
; // expected-warning {{'c0' is deprecated}}
230 template <class T
> struct D
{
233 d1
__attribute__((deprecated
)), // expected-note {{'d1' has been explicitly marked deprecated here}}
239 x
= D
<int>::d1
; // expected-warning {{'d1' is deprecated}}
245 void* operator new(typeof(sizeof(void*))) __attribute__((deprecated
)); // expected-note{{'operator new' has been explicitly marked deprecated here}}
246 void operator delete(void *) __attribute__((deprecated
)); // expected-note{{'operator delete' has been explicitly marked deprecated here}}
250 X
*x
= new X
; // expected-warning{{'operator new' is deprecated}} expected-warning{{'operator delete' is deprecated}}
254 // rdar://problem/15044218
256 } TDS
__attribute__((deprecated
)); // expected-note {{'TDS' has been explicitly marked deprecated here}}
257 TDS tds
; // expected-warning {{'TDS' is deprecated}}
258 struct TDS tds2
; // no warning, attribute only applies to the typedef.
262 // expected-note@+1 {{'B' has been explicitly marked deprecated here}}
263 struct __attribute__((deprecated
)) B
{};
265 template <typename T
> struct D
: T
{
267 B b
; // expected-warning {{'B' is deprecated}}
269 D
<A
> da
; // expected-note {{in instantiation of template class}}