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

Richard Smith richard-llvm at metafoo.co.uk
Tue Feb 24 13:44:44 PST 2015


Author: rsmith
Date: Tue Feb 24 15:44:43 2015
New Revision: 230384

URL: http://llvm.org/viewvc/llvm-project?rev=230384&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/Sema/SemaExprCXX.cpp
    cfe/trunk/test/SemaCXX/deleted-function.cpp

Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=230384&r1=230383&r2=230384&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Tue Feb 24 15:44:43 2015
@@ -2591,7 +2591,7 @@ static ExprResult BuildCXXCastArgument(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(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.

Modified: cfe/trunk/test/SemaCXX/deleted-function.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/deleted-function.cpp?rev=230384&r1=230383&r2=230384&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/deleted-function.cpp (original)
+++ cfe/trunk/test/SemaCXX/deleted-function.cpp Tue Feb 24 15:44:43 2015
@@ -87,3 +87,9 @@ int dc12 = use_dc({0}); // expected-erro
 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}}





More information about the cfe-commits mailing list