Make sure to diagnose use of declarations in the case where we create an implicit CXXThisExpr.

llvm-svn: 78474
This commit is contained in:
Anders Carlsson 2009-08-08 16:55:18 +00:00
parent d3a114fe2d
commit 21776b75ce
2 changed files with 18 additions and 0 deletions

View 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));
}

View File

@ -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}}
}