[PATCH] D11334: [Sema] Call to deleted functions are supposed to be verboten
Davide Italiano
dccitaliano at gmail.com
Tue Jul 21 14:38:03 PDT 2015
davide updated this revision to Diff 30288.
davide added a comment.
Addressing comments.
http://reviews.llvm.org/D11334
Files:
lib/Sema/SemaOverload.cpp
test/SemaCXX/deleted-function-access.cpp
Index: test/SemaCXX/deleted-function-access.cpp
===================================================================
--- test/SemaCXX/deleted-function-access.cpp
+++ test/SemaCXX/deleted-function-access.cpp
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
+
+struct S { virtual void f() = delete;
+ void g() { f(); } }; //expected-error{{call to deleted member function 'f'}}
Index: lib/Sema/SemaOverload.cpp
===================================================================
--- lib/Sema/SemaOverload.cpp
+++ lib/Sema/SemaOverload.cpp
@@ -11604,6 +11604,14 @@
FoundDecl = MemExpr->getFoundDecl();
Qualifier = MemExpr->getQualifier();
UnbridgedCasts.restore();
+
+ // Calls to deleted member functions are verboten.
+ if (Method && Method->isDeleted())
+ Diag(MemExpr->getLocStart(), diag::err_ovl_deleted_member_call)
+ << true /* isDeleted */
+ << Method
+ << getDeletedOrUnavailableSuffix(Method)
+ << MemExpr->getSourceRange();
} else {
UnresolvedMemberExpr *UnresExpr = cast<UnresolvedMemberExpr>(NakedMemExpr);
Qualifier = UnresExpr->getQualifier();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11334.30288.patch
Type: text/x-patch
Size: 1149 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150721/4d944747/attachment.bin>
More information about the cfe-commits
mailing list