From d5bb58460edf45c3f7806e0772b9859837879bf8 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 25 Oct 2022 14:35:49 +0200 Subject: 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. "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 ). > In file included from sc/source/ui/dbgui/dbnamdlg.cxx:20: > In file included from ~/llvm/inst/bin/../include/c++/v1/memory:881: > In file included from ~/llvm/inst/bin/../include/c++/v1/__memory/shared_ptr.h:30: > ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:47:19: error: invalid application of 'sizeof' to an incomplete type '(anonymous namespace)::DBSaveData' > 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<(anonymous namespace)::DBSaveData>::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<(anonymous namespace)::DBSaveData>::reset' requested here > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); } > ^ > sc/source/ui/dbgui/dbnamdlg.cxx:46:36: note: in instantiation of member function 'std::unique_ptr<(anonymous namespace)::DBSaveData>::~unique_ptr' requested here > static std::unique_ptr xSaveObj; > ^ > sc/source/ui/dbgui/dbnamdlg.cxx:42:7: note: forward declaration of '(anonymous namespace)::DBSaveData' > class DBSaveData; > ^ Change-Id: I65850c11a42886484dfbfbd4566ad71486337bc8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141816 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- sc/source/ui/dbgui/dbnamdlg.cxx | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx index a2ac72209e93..9224baa43095 100644 --- a/sc/source/ui/dbgui/dbnamdlg.cxx +++ b/sc/source/ui/dbgui/dbnamdlg.cxx @@ -37,14 +37,6 @@ #include #include -namespace { - -class DBSaveData; - -} - -static std::unique_ptr xSaveObj; - namespace { void ERRORBOX(weld::Window* pParent, const OUString& rString) @@ -126,6 +118,7 @@ void DBSaveData::Restore() } } +static std::unique_ptr xSaveObj; ScDbNameDlg::ScDbNameDlg(SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent, ScViewData& rViewData) -- cgit