]> granicus.if.org Git - clang/commitdiff
Make sure to diagnose use of declarations in the case where we create an implicit...
authorAnders Carlsson <andersca@mac.com>
Sat, 8 Aug 2009 16:55:18 +0000 (16:55 +0000)
committerAnders Carlsson <andersca@mac.com>
Sat, 8 Aug 2009 16:55:18 +0000 (16:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78474 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExpr.cpp
test/SemaCXX/attr-deprecated.cpp [new file with mode: 0644]

index 5d9b69c844874d5f821c96b76e301883a16034ae..cec1aeafac53ea3cbb345de154818dfa9011df7b 100644 (file)
@@ -1139,6 +1139,8 @@ Sema::BuildDeclarationNameExpr(SourceLocation Loc, NamedDecl *D,
           MarkDeclarationReferenced(Loc, D);
           if (PerformObjectMemberConversion(This, D))
             return ExprError();
+          if (DiagnoseUseOfDecl(D, Loc))
+            return ExprError();
           return Owned(new (Context) MemberExpr(This, true, D,
                                                 Loc, MemberType));
         }
diff --git a/test/SemaCXX/attr-deprecated.cpp b/test/SemaCXX/attr-deprecated.cpp
new file mode 100644 (file)
index 0000000..a647d81
--- /dev/null
@@ -0,0 +1,16 @@
+// RUN: clang-cc %s -verify -fsyntax-only
+class A {
+  void f() __attribute__((deprecated));
+  void g(A* a);
+
+  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}}
+}