summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-08-08 16:55:18 +0000
committerAnders Carlsson <andersca@mac.com>2009-08-08 16:55:18 +0000
commit21776b75ceddd24955c4aabee456e4f5fd2cd16e (patch)
tree9653c0a7be2cf5a585eba680ea63f8cf87e7f7fc
parentd3a114fe2d887bd3c5f9a3b12b2036fbd6b3795c (diff)
downloadbcm5719-llvm-21776b75ceddd24955c4aabee456e4f5fd2cd16e.tar.gz
bcm5719-llvm-21776b75ceddd24955c4aabee456e4f5fd2cd16e.zip
Make sure to diagnose use of declarations in the case where we create an implicit CXXThisExpr.
llvm-svn: 78474
-rw-r--r--clang/lib/Sema/SemaExpr.cpp2
-rw-r--r--clang/test/SemaCXX/attr-deprecated.cpp16
2 files changed, 18 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 5d9b69c8448..cec1aeafac5 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -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/clang/test/SemaCXX/attr-deprecated.cpp b/clang/test/SemaCXX/attr-deprecated.cpp
new file mode 100644
index 00000000000..a647d8124dd
--- /dev/null
+++ b/clang/test/SemaCXX/attr-deprecated.cpp
@@ -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}}
+}
OpenPOWER on IntegriCloud