r285655 - [modules] Mark deleted functions as implicitly inline to allow merging

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 31 16:07:15 PDT 2016


Author: ericwf
Date: Mon Oct 31 18:07:15 2016
New Revision: 285655

URL: http://llvm.org/viewvc/llvm-project?rev=285655&view=rev
Log:
[modules] Mark deleted functions as implicitly inline to allow  merging

Summary: When merging definitions with ModulesLocalVisibility enabled it's important to make deleted definitions implicitly inline, otherwise they'll be diagnosed as a redefinition.

Reviewers: silvas, manmanren, rsmith

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D26143

Modified:
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp
    cfe/trunk/test/Modules/Inputs/merge-decl-context/a.h

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=285655&r1=285654&r2=285655&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Mon Oct 31 18:07:15 2016
@@ -13875,6 +13875,9 @@ void Sema::SetDeclDeleted(Decl *Dcl, Sou
   if (Fn->isMain())
     Diag(DelLoc, diag::err_deleted_main);
 
+  // C++11 [dcl.fct.def.delete]p4:
+  //  A deleted function is implicitly inline.
+  Fn->setImplicitlyInline();
   Fn->setDeletedAsWritten();
 }
 

Modified: cfe/trunk/test/Modules/Inputs/merge-decl-context/a.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/merge-decl-context/a.h?rev=285655&r1=285654&r2=285655&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/merge-decl-context/a.h (original)
+++ cfe/trunk/test/Modules/Inputs/merge-decl-context/a.h Mon Oct 31 18:07:15 2016
@@ -24,5 +24,6 @@ inline A<int> ff(int i) {
 struct Aggregate {
   int member;
 };
+bool operator==(Aggregate, Aggregate) = delete;
 
 #endif




More information about the cfe-commits mailing list