starmath/source/ElementsDockingWindow.cxx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
New commits: commit ec27f2e5e39034ac4b38323149df72be28cba274 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Tue Oct 25 14:38:18 2022 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Tue Oct 25 16:45:06 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 starmath/source/ElementsDockingWindow.cxx:20: > In file included from starmath/inc/ElementsDockingWindow.hxx:22: > In file included from include/sfx2/dockwin.hxx:22: > 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 'ElementData' > 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<ElementData>::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<ElementData>::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<ElementData>::~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<ElementData>, 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<ElementData>, 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<ElementData>>>::destroy<std::unique_ptr<ElementData>, 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<ElementData>>::__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<ElementData>>::__clear' requested here > __clear(); > ^ > starmath/source/ElementsDockingWindow.cxx:455:20: note: in instantiation of member function 'std::vector<std::unique_ptr<ElementData>>::~vector' requested here > SmElementsControl::SmElementsControl(std::unique_ptr<weld::IconView> pIconView) > ^ > starmath/inc/ElementsDockingWindow.hxx:35:8: note: forward declaration of 'ElementData' > struct ElementData; > ^ Change-Id: Iaae76ed5e59d04da32b468a69052ef305ca8005a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141819 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index c332c5afda2d..0444db4ba42a 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -452,6 +452,17 @@ const std::vector<TranslateId>& SmElementsControl::categories() return s_a5Categories; } +struct ElementData +{ + OUString maElementSource; + OUString maHelpText; + ElementData(const OUString& aElementSource, const OUString& aHelpText) + : maElementSource(aElementSource) + , maHelpText(aHelpText) + { + } +}; + SmElementsControl::SmElementsControl(std::unique_ptr<weld::IconView> pIconView) : mpDocShell(new SmDocShell(SfxModelFlags::EMBEDDED_OBJECT)) , mnCurrentSetIndex(-1) @@ -482,17 +493,6 @@ Color SmElementsControl::GetControlBackground() return rStyleSettings.GetFieldColor(); } -struct ElementData -{ - OUString maElementSource; - OUString maHelpText; - ElementData(const OUString& aElementSource, const OUString& aHelpText) - : maElementSource(aElementSource) - , maHelpText(aHelpText) - { - } -}; - void SmElementsControl::addElement(const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText) { std::unique_ptr<SmNode> pNode = maParser->ParseExpression(aElementVisual);