[PATCH] D11334: [Sema] Call to deleted functions are supposed to be verboten
Richard Smith
richard at metafoo.co.uk
Tue Jul 21 14:59:30 PDT 2015
rsmith added inline comments.
================
Comment at: lib/Sema/SemaOverload.cpp:11608
@@ +11607,3 @@
+
+ // Calls to deleted member functions are verboten.
+ if (Method && Method->isDeleted())
----------------
This check should happen when we build the `MemberExpr`, not when we use it. It looks like the bug is in `Sema::BuildMemberReferenceExpr`, at around line 1050 of SemaExprMember.cpp:
bool ShouldCheckUse = true;
if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(MemberDecl)) {
// Don't diagnose the use of a virtual member function unless it's
// explicitly qualified.
if (MD->isVirtual() && !SS.isSet())
ShouldCheckUse = false;
}
// Check the use of this member.
if (ShouldCheckUse && DiagnoseUseOfDecl(MemberDecl, MemberLoc))
return ExprError();
This is wrong: we should `DiagnoseUseOfDecl` (including diagnosing the use of a deleted function) even for a virtual function. Which tests fail if we unconditionally `DiagnoseUseOfDecl` here?
http://reviews.llvm.org/D11334
More information about the cfe-commits
mailing list