sw/inc/tblsel.hxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
New commits: commit d55358c7c31e2e9f124ee90d78eba2db3f1af756 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Tue Oct 25 14:39:07 2022 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Tue Oct 25 17:48:28 2022 +0200 Address a constexpr template point of instantiation issue ...that hits at least when building with Clang and --with-latest-c++ against recent libc++ or MSVC standard library (where C++20 and esp. C++23 made more and more class template member functions constexpr). My understanding is that there is some leeway at what point a compiler should instantiate such function specializations, and Clang decides to instantiate constexpr ones early (cf. <https://github.com/llvm/llvm-project/commit/242ad89a15d5466d166d47978bfff983d40ab511> "C++11 half of r147023: In C++11, additionally eagerly instantiate:" and its "Do not defer instantiations of constexpr functions" comment, and the discussion at <https://discourse.llvm.org/t/point-of-instantiation-of-constexpr-function-template/65129>). > In file included from sw/source/core/access/acccell.cxx:20: > In file included from include/sal/log.hxx:20: > In file included from ~/llvm/inst/bin/../include/c++/v1/sstream:186: > In file included from ~/llvm/inst/bin/../include/c++/v1/istream:165: > In file included from ~/llvm/inst/bin/../include/c++/v1/ostream:168: > ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:47:19: error: invalid application of 'sizeof' to an incomplete type 'FndLine_' > static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete type"); > ^~~~~~~~~~~ > ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:281:7: note: in instantiation of member function 'std::default_delete<FndLine_>::operator()' requested here > __ptr_.second()(__tmp); > ^ > ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:247:75: note: in instantiation of member function 'std::unique_ptr<FndLine_>::reset' requested here > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); } > ^ > ~/llvm/inst/bin/../include/c++/v1/__memory/construct_at.h:64:13: note: in instantiation of member function 'std::unique_ptr<FndLine_>::~unique_ptr' requested here > __loc->~_Tp(); > ^ > ~/llvm/inst/bin/../include/c++/v1/__memory/construct_at.h:89:12: note: in instantiation of function template specialization 'std::__destroy_at<std::unique_ptr<FndLine_>, 0>' requested here > _VSTD::__destroy_at(__loc); > ^ > ~/llvm/inst/bin/../include/c++/v1/__memory/allocator_traits.h:317:16: note: in instantiation of function template specialization 'std::destroy_at<std::unique_ptr<FndLine_>, 0>' requested here > _VSTD::destroy_at(__p); > ^ > ~/llvm/inst/bin/../include/c++/v1/vector:834:25: note: in instantiation of function template specialization 'std::allocator_traits<std::allocator<std::unique_ptr<FndLine_>>>::destroy<std::unique_ptr<FndLine_>, void, void>' requested here > __alloc_traits::destroy(__alloc(), std::__to_address(--__soon_to_be_end)); > ^ > ~/llvm/inst/bin/../include/c++/v1/vector:828:29: note: in instantiation of member function 'std::vector<std::unique_ptr<FndLine_>>::__base_destruct_at_end' requested here > void __clear() _NOEXCEPT {__base_destruct_at_end(this->__begin_);} > ^ > ~/llvm/inst/bin/../include/c++/v1/vector:433:9: note: in instantiation of member function 'std::vector<std::unique_ptr<FndLine_>>::__clear' requested here > __clear(); > ^ > sw/inc/tblsel.hxx:170:5: note: in instantiation of member function 'std::vector<std::unique_ptr<FndLine_>>::~vector' requested here > FndBox_( SwTableBox* pB, FndLine_* pFL ) : > ^ > sw/inc/tblsel.hxx:152:7: note: forward declaration of 'FndLine_' > class FndLine_; > ^ Change-Id: Ia088547c6463a55f48bb4c4ca5107b3bf9472ff1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141820 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/sw/inc/tblsel.hxx b/sw/inc/tblsel.hxx index 35f88cb9bb54..892376ba6f48 100644 --- a/sw/inc/tblsel.hxx +++ b/sw/inc/tblsel.hxx @@ -167,8 +167,7 @@ class FndBox_ FndBox_& operator=(FndBox_ const&) = delete; public: - FndBox_( SwTableBox* pB, FndLine_* pFL ) : - m_pBox(pB), m_pUpper(pFL), m_pLineBefore( nullptr ), m_pLineBehind( nullptr ) {} + inline FndBox_( SwTableBox* pB, FndLine_* pFL ); const FndLines_t& GetLines() const { return m_Lines; } FndLines_t& GetLines() { return m_Lines; } @@ -210,6 +209,9 @@ public: void SetUpper( FndBox_* pUp ) { m_pUpper = pUp; } }; +FndBox_::FndBox_( SwTableBox* pB, FndLine_* pFL ) : + m_pBox(pB), m_pUpper(pFL), m_pLineBefore( nullptr ), m_pLineBehind( nullptr ) {} + struct FndPara { const SwSelBoxes& rBoxes;