PR22673 again: diagnose use of the used decl, not the found decl. This is also

wrong (DiagnoseUseOfDecl should take both), but it's more consistent with what
we do in other places.

llvm-svn: 230384
This commit is contained in:
Richard Smith 2015-02-24 21:44:43 +00:00
parent 2ce48056a4
commit 7c9442a6ae
2 changed files with 8 additions and 2 deletions

View File

@ -2591,7 +2591,7 @@ static ExprResult BuildCXXCastArgument(Sema &S,
S.CheckConstructorAccess(CastLoc, Constructor,
InitializedEntity::InitializeTemporary(Ty),
Constructor->getAccess());
if (S.DiagnoseUseOfDecl(FoundDecl, CastLoc))
if (S.DiagnoseUseOfDecl(Method, CastLoc))
return ExprError();
ExprResult Result = S.BuildCXXConstructExpr(
@ -2609,7 +2609,7 @@ static ExprResult BuildCXXCastArgument(Sema &S,
assert(!From->getType()->isPointerType() && "Arg can't have pointer type!");
S.CheckMemberOperatorAccess(CastLoc, From, /*arg*/ nullptr, FoundDecl);
if (S.DiagnoseUseOfDecl(FoundDecl, CastLoc))
if (S.DiagnoseUseOfDecl(Method, CastLoc))
return ExprError();
// Create an implicit call expr that calls it.

View File

@ -87,3 +87,9 @@ int dc12 = use_dc({0}); // expected-error {{deleted}}
int use_dcr(const DelCtor &); // expected-note {{here}}
int dc13 = use_dcr(0); // expected-error {{deleted}}
int dc14 = use_dcr({0}); // expected-error {{deleted}}
struct DelCtorTemplate {
template<typename T> DelCtorTemplate(T) = delete; // expected-note {{deleted}}
};
int use_dct(const DelCtorTemplate &);
int dc15 = use_dct(0); // expected-error {{deleted}}