diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-10-25 14:35:49 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-10-25 16:24:33 +0200 |
commit | d5bb58460edf45c3f7806e0772b9859837879bf8 (patch) | |
tree | 366f103d1b2b2e3133de9e240993bdfb8dfcf80d /sc/source/ui/dbgui/dbnamdlg.cxx | |
parent | ef862ba4b1b0b4799ec9afd294cf1b2c84f7ef1f (diff) |
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 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<DBSaveData> 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 <sbergman@redhat.com>
Diffstat (limited to 'sc/source/ui/dbgui/dbnamdlg.cxx')
-rw-r--r-- | sc/source/ui/dbgui/dbnamdlg.cxx | 9 |
1 files changed, 1 insertions, 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 <dbnamdlg.hxx> #include <dbdocfun.hxx> -namespace { - -class DBSaveData; - -} - -static std::unique_ptr<DBSaveData> xSaveObj; - namespace { void ERRORBOX(weld::Window* pParent, const OUString& rString) @@ -126,6 +118,7 @@ void DBSaveData::Restore() } } +static std::unique_ptr<DBSaveData> xSaveObj; ScDbNameDlg::ScDbNameDlg(SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent, ScViewData& rViewData) |