diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-10-25 14:29:19 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-10-25 16:22:04 +0200 |
commit | 3c5a98135fe55bf48cfd11b4e163906fbfe0d115 (patch) | |
tree | be2433a68666d8d85eb5858ad04618eea349464e /cui/source | |
parent | 16045087e6541925be340d585e68a35147489b59 (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 cui/source/dialogs/cuihyperdlg.cxx:23:
> In file included from include/comphelper/lok.hxx:14:
> In file included from include/rtl/ustring.hxx:34:
> 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 'IconChoicePage'
> 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<IconChoicePage>::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<IconChoicePage>::reset' requested here
> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); }
> ^
> cui/source/inc/iconcdlg.hxx:43:5: note: in instantiation of member function 'std::unique_ptr<IconChoicePage>::~unique_ptr' requested here
> IconChoicePageData(OString aId, std::unique_ptr<IconChoicePage> xInPage)
> ^
> cui/source/inc/iconcdlg.hxx:28:7: note: forward declaration of 'IconChoicePage'
> class IconChoicePage;
> ^
Change-Id: I789c85e0661969679c88fea1dfc7a65475fb3037
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141811
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'cui/source')
-rw-r--r-- | cui/source/inc/iconcdlg.hxx | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/cui/source/inc/iconcdlg.hxx b/cui/source/inc/iconcdlg.hxx index 1803a9a633e2..6367016fe8b5 100644 --- a/cui/source/inc/iconcdlg.hxx +++ b/cui/source/inc/iconcdlg.hxx @@ -32,21 +32,6 @@ class SfxItemSet; // Create-Function typedef std::unique_ptr<IconChoicePage> (*CreatePage)(weld::Container* pParent, SvxHpLinkDlg* pDlg, const SfxItemSet* pAttrSet); -/// Data-structure for pages in dialog -struct IconChoicePageData -{ - OString sId; - std::unique_ptr<IconChoicePage> xPage; ///< the TabPage itself - bool bRefresh; ///< Flag: page has to be newly initialized - - // constructor - IconChoicePageData(OString aId, std::unique_ptr<IconChoicePage> xInPage) - : sId(std::move(aId)) - , xPage(std::move(xInPage)) - , bRefresh(false) - {} -}; - class IconChoicePage { protected: @@ -79,4 +64,19 @@ public: virtual bool QueryClose(); }; +/// Data-structure for pages in dialog +struct IconChoicePageData +{ + OString sId; + std::unique_ptr<IconChoicePage> xPage; ///< the TabPage itself + bool bRefresh; ///< Flag: page has to be newly initialized + + // constructor + IconChoicePageData(OString aId, std::unique_ptr<IconChoicePage> xInPage) + : sId(std::move(aId)) + , xPage(std::move(xInPage)) + , bRefresh(false) + {} +}; + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |