vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx |   80 +++++++++++++++---------------
 1 file changed, 40 insertions(+), 40 deletions(-)

New commits:
commit 4458cf6930fdbda44345fcd1bd9b5c0664cffb9f
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Tue Oct 25 14:41:04 2022 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Tue Oct 25 17:29:16 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 vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx:43:
    > In file included from vcl/inc/unx/gtk/gtkdata.hxx:34:
    > In file included from vcl/inc/unx/gendata.hxx:15:
    > In file included from vcl/inc/svdata.hxx:26:
    > In file included from include/o3tl/hash_combine.hxx:13:
    > In file included from ~/llvm/inst/bin/../include/c++/v1/functional:515:
    > In file included from 
~/llvm/inst/bin/../include/c++/v1/__functional/boyer_moore_searcher.h:26:
    > ~/llvm/inst/bin/../include/c++/v1/vector:538:52: error: arithmetic on a 
pointer to an incomplete type 'FilterEntry'
    >         {return static_cast<size_type>(__end_cap() - this->__begin_);}
    >                                        ~~~~~~~~~~~ ^
    > ~/llvm/inst/bin/../include/c++/v1/vector:761:56: note: in instantiation 
of member function 'std::vector<FilterEntry>::capacity' requested here
    >       __annotate_contiguous_container(data(), data() + capacity(),
    >                                                        ^
    > ~/llvm/inst/bin/../include/c++/v1/vector:428:7: note: in instantiation of 
member function 'std::vector<FilterEntry>::__annotate_delete' requested here
    >       __annotate_delete();
    >       ^
    > ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:49:5: note: in 
instantiation of member function 'std::vector<FilterEntry>::~vector' requested 
here
    >     delete __ptr;
    >     ^
    > ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:281:7: note: in 
instantiation of member function 
'std::default_delete<std::vector<FilterEntry>>::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<std::vector<FilterEntry>>::reset' requested here
    >   _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { 
reset(); }
    >                                                                           
^
    > vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx:86:19: note: in instantiation 
of member function 'std::unique_ptr<std::vector<FilterEntry>>::~unique_ptr' 
requested here
    > SalGtkFilePicker::SalGtkFilePicker( const uno::Reference< 
uno::XComponentContext >& xContext ) :
    >                   ^
    > vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx:38:8: note: forward declaration 
of 'FilterEntry'
    > struct FilterEntry;
    >        ^
    > In file included from vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx:43:
    > In file included from vcl/inc/unx/gtk/gtkdata.hxx:34:
    > In file included from vcl/inc/unx/gendata.hxx:15:
    > In file included from vcl/inc/svdata.hxx:26:
    > In file included from include/o3tl/hash_combine.hxx:13:
    > In file included from ~/llvm/inst/bin/../include/c++/v1/functional:515:
    > In file included from 
~/llvm/inst/bin/../include/c++/v1/__functional/boyer_moore_searcher.h:26:
    > ~/llvm/inst/bin/../include/c++/v1/vector:761:54: error: arithmetic on a 
pointer to an incomplete type 'const value_type' (aka 'const FilterEntry')
    >       __annotate_contiguous_container(data(), data() + capacity(),
    >                                               ~~~~~~ ^
    > ~/llvm/inst/bin/../include/c++/v1/vector:428:7: note: in instantiation of 
member function 'std::vector<FilterEntry>::__annotate_delete' requested here
    >       __annotate_delete();
    >       ^
    > ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:49:5: note: in 
instantiation of member function 'std::vector<FilterEntry>::~vector' requested 
here
    >     delete __ptr;
    >     ^
    > ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:281:7: note: in 
instantiation of member function 
'std::default_delete<std::vector<FilterEntry>>::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<std::vector<FilterEntry>>::reset' requested here
    >   _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { 
reset(); }
    >                                                                           
^
    > vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx:86:19: note: in instantiation 
of member function 'std::unique_ptr<std::vector<FilterEntry>>::~unique_ptr' 
requested here
    > SalGtkFilePicker::SalGtkFilePicker( const uno::Reference< 
uno::XComponentContext >& xContext ) :
    >                   ^
    > vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx:38:8: note: forward declaration 
of 'FilterEntry'
    > struct FilterEntry;
    >        ^
    > In file included from vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx:43:
    > In file included from vcl/inc/unx/gtk/gtkdata.hxx:34:
    > In file included from vcl/inc/unx/gendata.hxx:15:
    > In file included from vcl/inc/svdata.hxx:26:
    > In file included from include/o3tl/hash_combine.hxx:13:
    > In file included from ~/llvm/inst/bin/../include/c++/v1/functional:515:
    > In file included from 
~/llvm/inst/bin/../include/c++/v1/__functional/boyer_moore_searcher.h:26:
    > ~/llvm/inst/bin/../include/c++/v1/vector:834:62: error: arithmetic on a 
pointer to an incomplete type 'FilterEntry'
    >         __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<FilterEntry>::__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<FilterEntry>::__clear' requested here
    >         __clear();
    >         ^
    > ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:49:5: note: in 
instantiation of member function 'std::vector<FilterEntry>::~vector' requested 
here
    >     delete __ptr;
    >     ^
    > ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:281:7: note: in 
instantiation of member function 
'std::default_delete<std::vector<FilterEntry>>::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<std::vector<FilterEntry>>::reset' requested here
    >   _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { 
reset(); }
    >                                                                           
^
    > vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx:86:19: note: in instantiation 
of member function 'std::unique_ptr<std::vector<FilterEntry>>::~unique_ptr' 
requested here
    > SalGtkFilePicker::SalGtkFilePicker( const uno::Reference< 
uno::XComponentContext >& xContext ) :
    >                   ^
    > vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx:38:8: note: forward declaration 
of 'FilterEntry'
    > struct FilterEntry;
    >        ^
    > In file included from vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx:28:
    > In file included from 
workdir/UnoApiHeadersTarget/offapi/normal/com/sun/star/awt/SystemDependentXWindow.hpp:8:
    > In file included from include/com/sun/star/uno/Type.hxx:29:
    > In file included from ~/llvm/inst/bin/../include/c++/v1/ostream:169:
    > In file included from ~/llvm/inst/bin/../include/c++/v1/bitset:129:
    > In file included from ~/llvm/inst/bin/../include/c++/v1/string:548:
    > ~/llvm/inst/bin/../include/c++/v1/__memory/allocator.h:128:58: error: 
invalid application of 'sizeof' to an incomplete type 'FilterEntry'
    >             _VSTD::__libcpp_deallocate((void*)__p, __n * sizeof(_Tp), 
_LIBCPP_ALIGNOF(_Tp));
    >                                                          ^~~~~~~~~~~
    > ~/llvm/inst/bin/../include/c++/v1/__memory/allocator_traits.h:282:13: 
note: in instantiation of member function 
'std::allocator<FilterEntry>::deallocate' requested here
    >         __a.deallocate(__p, __n);
    >             ^
    > ~/llvm/inst/bin/../include/c++/v1/vector:434:25: note: in instantiation 
of member function 
'std::allocator_traits<std::allocator<FilterEntry>>::deallocate' requested here
    >         __alloc_traits::deallocate(__alloc(), this->__begin_, capacity());
    >                         ^
    > ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:49:5: note: in 
instantiation of member function 'std::vector<FilterEntry>::~vector' requested 
here
    >     delete __ptr;
    >     ^
    > ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:281:7: note: in 
instantiation of member function 
'std::default_delete<std::vector<FilterEntry>>::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<std::vector<FilterEntry>>::reset' requested here
    >   _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { 
reset(); }
    >                                                                           
^
    > vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx:86:19: note: in instantiation 
of member function 'std::unique_ptr<std::vector<FilterEntry>>::~unique_ptr' 
requested here
    > SalGtkFilePicker::SalGtkFilePicker( const uno::Reference< 
uno::XComponentContext >& xContext ) :
    >                   ^
    > vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx:38:8: note: forward declaration 
of 'FilterEntry'
    > struct FilterEntry;
    >        ^
    
    Change-Id: I6f76dc24b12214eda75d3a5bb91a0fe120e38880
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141822
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx 
b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
index e578d2a1a271..7a74cdaf937a 100644
--- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
@@ -66,6 +66,46 @@ using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::uno;
 
+struct FilterEntry
+{
+protected:
+    OUString     m_sTitle;
+    OUString     m_sFilter;
+
+    css::uno::Sequence< css::beans::StringPair >       m_aSubFilters;
+
+public:
+    FilterEntry( OUString _aTitle, OUString _aFilter )
+        :m_sTitle(std::move( _aTitle ))
+        ,m_sFilter(std::move( _aFilter ))
+    {
+    }
+
+    const OUString& getTitle() const { return m_sTitle; }
+    const OUString& getFilter() const { return m_sFilter; }
+
+    /// determines if the filter has sub filter (i.e., the filter is a filter 
group in real)
+    bool        hasSubFilters( ) const;
+
+    /** retrieves the filters belonging to the entry
+    */
+    void       getSubFilters( css::uno::Sequence< css::beans::StringPair >& 
_rSubFilterList );
+
+    // helpers for iterating the sub filters
+    const css::beans::StringPair*   beginSubFilters() const { return 
m_aSubFilters.begin(); }
+    const css::beans::StringPair*   endSubFilters() const { return 
m_aSubFilters.end(); }
+};
+
+bool FilterEntry::hasSubFilters() const
+{
+    return m_aSubFilters.hasElements();
+}
+
+void FilterEntry::getSubFilters( css::uno::Sequence< css::beans::StringPair >& 
_rSubFilterList )
+{
+    _rSubFilterList = m_aSubFilters;
+}
+
 void SalGtkFilePicker::dialog_mapped_cb(GtkWidget *, SalGtkFilePicker *pobjFP)
 {
     pobjFP->InitialMapping();
@@ -359,46 +399,6 @@ void SalGtkFilePicker::impl_controlStateChanged( const 
FilePickerEvent& aEvent )
     if (m_xListener.is()) m_xListener->controlStateChanged( aEvent );
 }
 
-struct FilterEntry
-{
-protected:
-    OUString     m_sTitle;
-    OUString     m_sFilter;
-
-    css::uno::Sequence< css::beans::StringPair >       m_aSubFilters;
-
-public:
-    FilterEntry( OUString _aTitle, OUString _aFilter )
-        :m_sTitle(std::move( _aTitle ))
-        ,m_sFilter(std::move( _aFilter ))
-    {
-    }
-
-    const OUString& getTitle() const { return m_sTitle; }
-    const OUString& getFilter() const { return m_sFilter; }
-
-    /// determines if the filter has sub filter (i.e., the filter is a filter 
group in real)
-    bool        hasSubFilters( ) const;
-
-    /** retrieves the filters belonging to the entry
-    */
-    void       getSubFilters( css::uno::Sequence< css::beans::StringPair >& 
_rSubFilterList );
-
-    // helpers for iterating the sub filters
-    const css::beans::StringPair*   beginSubFilters() const { return 
m_aSubFilters.begin(); }
-    const css::beans::StringPair*   endSubFilters() const { return 
m_aSubFilters.end(); }
-};
-
-bool FilterEntry::hasSubFilters() const
-{
-    return m_aSubFilters.hasElements();
-}
-
-void FilterEntry::getSubFilters( css::uno::Sequence< css::beans::StringPair >& 
_rSubFilterList )
-{
-    _rSubFilterList = m_aSubFilters;
-}
-
 static bool
 isFilterString( std::u16string_view rFilterString, const char *pMatch )
 {

Reply via email to