aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/attr-deprecated.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/attr-deprecated.cpp')
-rw-r--r--test/SemaCXX/attr-deprecated.cpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/test/SemaCXX/attr-deprecated.cpp b/test/SemaCXX/attr-deprecated.cpp
new file mode 100644
index 000000000000..54f8b5b57fcd
--- /dev/null
+++ b/test/SemaCXX/attr-deprecated.cpp
@@ -0,0 +1,66 @@
+// RUN: clang-cc %s -verify -fsyntax-only
+class A {
+ void f() __attribute__((deprecated));
+ void g(A* a);
+ void h(A* a) __attribute__((deprecated));
+
+ int b __attribute__((deprecated));
+};
+
+void A::g(A* a)
+{
+ f(); // expected-warning{{'f' is deprecated}}
+ a->f(); // expected-warning{{'f' is deprecated}}
+
+ (void)b; // expected-warning{{'b' is deprecated}}
+ (void)a->b; // expected-warning{{'b' is deprecated}}
+}
+
+void A::h(A* a)
+{
+ f();
+ a->f();
+
+ (void)b;
+ (void)a->b;
+}
+
+struct B {
+ virtual void f() __attribute__((deprecated));
+ void g();
+};
+
+void B::g() {
+ f();
+ B::f(); // expected-warning{{'f' is deprecated}}
+}
+
+struct C : B {
+ virtual void f();
+ void g();
+};
+
+void C::g() {
+ f();
+ C::f();
+ B::f(); // expected-warning{{'f' is deprecated}}
+}
+
+void f(B* b, C *c) {
+ b->f();
+ b->B::f(); // expected-warning{{'f' is deprecated}}
+
+ c->f();
+ c->C::f();
+ c->B::f(); // expected-warning{{'f' is deprecated}}
+}
+
+struct D {
+ virtual void f() __attribute__((deprecated));
+};
+
+void D::f() { }
+
+void f(D* d) {
+ d->f();
+}