iains updated this revision to Diff 490062. iains added a comment. rebased, address review comments
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D141908/new/ https://reviews.llvm.org/D141908 Files: clang/lib/Sema/SemaDecl.cpp clang/test/CXX/module/module.import/p6.cpp Index: clang/test/CXX/module/module.import/p6.cpp =================================================================== --- clang/test/CXX/module/module.import/p6.cpp +++ clang/test/CXX/module/module.import/p6.cpp @@ -28,3 +28,11 @@ static const int value = 43; }; +void deleted_fn_ok (void) = delete; + +struct S { + ~S() noexcept(false) = default; +private: + S(S&); +}; +S::S(S&) = default; Index: clang/lib/Sema/SemaDecl.cpp =================================================================== --- clang/lib/Sema/SemaDecl.cpp +++ clang/lib/Sema/SemaDecl.cpp @@ -15254,9 +15254,12 @@ } // C++ [module.import/6] external definitions are not permitted in header - // units. + // units. Deleted and Defaulted functions are implicitly inline (but the + // inline state is not set at this point, so check the BodyKind explicitly). if (getLangOpts().CPlusPlusModules && currentModuleIsHeaderUnit() && - FD->getFormalLinkage() == Linkage::ExternalLinkage && !FD->isInlined()) { + FD->getFormalLinkage() == Linkage::ExternalLinkage && + !FD->isInvalidDecl() && BodyKind != FnBodyKind::Delete && + BodyKind != FnBodyKind::Default && !FD->isInlined()) { Diag(FD->getLocation(), diag::err_extern_def_in_header_unit); FD->setInvalidDecl(); }
Index: clang/test/CXX/module/module.import/p6.cpp =================================================================== --- clang/test/CXX/module/module.import/p6.cpp +++ clang/test/CXX/module/module.import/p6.cpp @@ -28,3 +28,11 @@ static const int value = 43; }; +void deleted_fn_ok (void) = delete; + +struct S { + ~S() noexcept(false) = default; +private: + S(S&); +}; +S::S(S&) = default; Index: clang/lib/Sema/SemaDecl.cpp =================================================================== --- clang/lib/Sema/SemaDecl.cpp +++ clang/lib/Sema/SemaDecl.cpp @@ -15254,9 +15254,12 @@ } // C++ [module.import/6] external definitions are not permitted in header - // units. + // units. Deleted and Defaulted functions are implicitly inline (but the + // inline state is not set at this point, so check the BodyKind explicitly). if (getLangOpts().CPlusPlusModules && currentModuleIsHeaderUnit() && - FD->getFormalLinkage() == Linkage::ExternalLinkage && !FD->isInlined()) { + FD->getFormalLinkage() == Linkage::ExternalLinkage && + !FD->isInvalidDecl() && BodyKind != FnBodyKind::Delete && + BodyKind != FnBodyKind::Default && !FD->isInlined()) { Diag(FD->getLocation(), diag::err_extern_def_in_header_unit); FD->setInvalidDecl(); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits