mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 21:53:12 +08:00
Make sure to diagnose use of declarations in the case where we create an implicit CXXThisExpr.
llvm-svn: 78474
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
16
clang/test/SemaCXX/attr-deprecated.cpp
Normal file
16
clang/test/SemaCXX/attr-deprecated.cpp
Normal 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}}
|
||||
}
|
||||
Reference in New Issue
Block a user