sfx2/source/dialog/StyleList.cxx |   46 +++++++++++++++++++--------------------
 1 file changed, 23 insertions(+), 23 deletions(-)

New commits:
commit ef862ba4b1b0b4799ec9afd294cf1b2c84f7ef1f
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Tue Oct 25 14:36:44 2022 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Tue Oct 25 16:24:04 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 sfx2/source/dialog/StyleList.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 'TreeViewDropTarget'
    >     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<TreeViewDropTarget>::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<TreeViewDropTarget>::reset' 
requested here
    >   _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { 
reset(); }
    >                                                                           
^
    > sfx2/source/dialog/StyleList.cxx:72:12: note: in instantiation of member 
function 'std::unique_ptr<TreeViewDropTarget>::~unique_ptr' requested here
    > StyleList::StyleList(weld::Builder* pBuilder, SfxBindings* pBindings,
    >            ^
    > sfx2/source/inc/StyleList.hxx:53:7: note: forward declaration of 
'TreeViewDropTarget'
    > class TreeViewDropTarget;
    >       ^
    
    Change-Id: I30c0c21a7366a9f45d8b4ce7c61270dac804c0b7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141817
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/sfx2/source/dialog/StyleList.cxx b/sfx2/source/dialog/StyleList.cxx
index aeccc1f99d3c..59455758e890 100644
--- a/sfx2/source/dialog/StyleList.cxx
+++ b/sfx2/source/dialog/StyleList.cxx
@@ -67,6 +67,29 @@ using namespace css::beans;
 using namespace css::frame;
 using namespace css::uno;
 
+class TreeViewDropTarget final : public DropTargetHelper
+{
+private:
+    StyleList& m_rParent;
+
+public:
+    TreeViewDropTarget(StyleList& rStyleList, weld::TreeView& rTreeView)
+        : DropTargetHelper(rTreeView.get_drop_target())
+        , m_rParent(rStyleList)
+    {
+    }
+
+    virtual sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt) override
+    {
+        return m_rParent.AcceptDrop(rEvt, *this);
+    }
+
+    virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt) override
+    {
+        return m_rParent.ExecuteDrop(rEvt);
+    }
+};
+
 // Constructor
 
 StyleList::StyleList(weld::Builder* pBuilder, SfxBindings* pBindings,
@@ -244,29 +267,6 @@ void StyleList::EnableNewByExample(bool 
newByExampleDisabled)
     m_bNewByExampleDisabled = newByExampleDisabled;
 }
 
-class TreeViewDropTarget final : public DropTargetHelper
-{
-private:
-    StyleList& m_rParent;
-
-public:
-    TreeViewDropTarget(StyleList& rStyleList, weld::TreeView& rTreeView)
-        : DropTargetHelper(rTreeView.get_drop_target())
-        , m_rParent(rStyleList)
-    {
-    }
-
-    virtual sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt) override
-    {
-        return m_rParent.AcceptDrop(rEvt, *this);
-    }
-
-    virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt) override
-    {
-        return m_rParent.ExecuteDrop(rEvt);
-    }
-};
-
 void StyleList::FilterSelect(sal_uInt16 nActFilter, bool bsetFilter)
 {
     m_nActFilter = nActFilter;

Reply via email to