summaryrefslogtreecommitdiff
path: root/sfx2/source/dialog/templdlg.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-10-25 14:37:37 +0200
committerStephan Bergmann <sbergman@redhat.com>2022-10-25 23:14:05 +0200
commitdc8fc774c35cc935331e04ddb8ab7646ffca775e (patch)
treef26e315e29f046bc43e7267e84d5b656da56f346 /sfx2/source/dialog/templdlg.cxx
parentfa3f04bdd4f73a1b3be70dfb709c44638ef7e3d9 (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 sfx2/source/dialog/templdlg.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 'ToolbarDropTarget' > 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<ToolbarDropTarget>::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<ToolbarDropTarget>::reset' requested here > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); } > ^ > sfx2/source/dialog/templdlg.cxx:665:25: note: in instantiation of member function 'std::unique_ptr<ToolbarDropTarget>::~unique_ptr' requested here > SfxTemplateDialog_Impl::SfxTemplateDialog_Impl(SfxBindings* pB, SfxTemplatePanelControl* pDlgWindow) > ^ > sfx2/source/inc/templdgi.hxx:198:7: note: forward declaration of 'ToolbarDropTarget' > class ToolbarDropTarget; > ^ Change-Id: I360f35e01e301bca6fa801a889b6d107f67faf15 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141818 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sfx2/source/dialog/templdlg.cxx')
-rw-r--r--sfx2/source/dialog/templdlg.cxx36
1 files changed, 18 insertions, 18 deletions
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index dc5763cce33b..fb9f8c1a0bc1 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -662,24 +662,6 @@ void SfxCommonTemplateDialog_Impl::EnableExample_Impl(sal_uInt16 nId, bool bEnab
}
}
-SfxTemplateDialog_Impl::SfxTemplateDialog_Impl(SfxBindings* pB, SfxTemplatePanelControl* pDlgWindow)
- : SfxCommonTemplateDialog_Impl(pB, pDlgWindow->get_container(), pDlgWindow->get_builder())
- , m_xActionTbL(pDlgWindow->get_builder()->weld_toolbar("left"))
- , m_xActionTbR(pDlgWindow->get_builder()->weld_toolbar("right"))
- , m_xToolMenu(pDlgWindow->get_builder()->weld_menu("toolmenu"))
- , m_nActionTbLVisible(0)
-{
- m_xActionTbR->set_item_help_id("watercan", HID_TEMPLDLG_WATERCAN);
- // shown/hidden in SfxTemplateDialog_Impl::ReplaceUpdateButtonByMenu()
- m_xActionTbR->set_item_help_id("new", HID_TEMPLDLG_NEWBYEXAMPLE);
- m_xActionTbR->set_item_help_id("newmenu", HID_TEMPLDLG_NEWBYEXAMPLE);
- m_xActionTbR->set_item_menu("newmenu", m_xToolMenu.get());
- m_xToolMenu->connect_activate(LINK(this, SfxTemplateDialog_Impl, ToolMenuSelectHdl));
- m_xActionTbR->set_item_help_id("update", HID_TEMPLDLG_UPDATEBYEXAMPLE);
-
- Initialize();
-}
-
class ToolbarDropTarget final : public DropTargetHelper
{
private:
@@ -703,6 +685,24 @@ public:
}
};
+SfxTemplateDialog_Impl::SfxTemplateDialog_Impl(SfxBindings* pB, SfxTemplatePanelControl* pDlgWindow)
+ : SfxCommonTemplateDialog_Impl(pB, pDlgWindow->get_container(), pDlgWindow->get_builder())
+ , m_xActionTbL(pDlgWindow->get_builder()->weld_toolbar("left"))
+ , m_xActionTbR(pDlgWindow->get_builder()->weld_toolbar("right"))
+ , m_xToolMenu(pDlgWindow->get_builder()->weld_menu("toolmenu"))
+ , m_nActionTbLVisible(0)
+{
+ m_xActionTbR->set_item_help_id("watercan", HID_TEMPLDLG_WATERCAN);
+ // shown/hidden in SfxTemplateDialog_Impl::ReplaceUpdateButtonByMenu()
+ m_xActionTbR->set_item_help_id("new", HID_TEMPLDLG_NEWBYEXAMPLE);
+ m_xActionTbR->set_item_help_id("newmenu", HID_TEMPLDLG_NEWBYEXAMPLE);
+ m_xActionTbR->set_item_menu("newmenu", m_xToolMenu.get());
+ m_xToolMenu->connect_activate(LINK(this, SfxTemplateDialog_Impl, ToolMenuSelectHdl));
+ m_xActionTbR->set_item_help_id("update", HID_TEMPLDLG_UPDATEBYEXAMPLE);
+
+ Initialize();
+}
+
void SfxTemplateDialog_Impl::Initialize()
{
SfxCommonTemplateDialog_Impl::Initialize();