On Tue, Jan 16, 2024 at 03:32:14PM -0800, Aleksei Bavshin wrote:
> On Tue, Jan 16, 2024 at 3:07 PM Richard Shaw <hobbes1...@gmail.com> wrote:
> >
> > I'm working on getting a new dependency of one of my packages into Fedora:
> >
> > https://github.com/socketio/socket.io-client-cpp/releases
> >
> > After doing successful test builds locally in mock (no error output at all) 
> > I used fedora-create-review but all the builds failed with:
> >
> > In file included from 
> > /builddir/build/BUILD/socket.io-client-cpp-3.1.0/src/internal/sio_packet.cpp:8:
> > /usr/include/rapidjson/document.h: In member function 
> > ‘rapidjson::GenericStringRef<CharType>& 
> > rapidjson::GenericStringRef<CharType>::operator=(const 
> > rapidjson::GenericStringRef<CharType>&)’:
> > /usr/include/rapidjson/document.h:319:82: error: assignment of read-only 
> > member ‘rapidjson::GenericStringRef<CharType>::length’
> >   319 |     GenericStringRef& operator=(const GenericStringRef& rhs) { s = 
> > rhs.s; length = rhs.length; }
> >       |                                                                     
> >       ~~~~~~~^~~~~~~~~~~~
> > gmake[2]: *** [CMakeFiles/sioclient.dir/build.make:121: 
> > CMakeFiles/sioclient.dir/src/internal/sio_packet.cpp.o] Error 1
> >
> > Full logs: https://koji.fedoraproject.org/koji/taskinfo?taskID=111852023
> >
> > Is this a real error?
> 
> Yes, see https://github.com/Tencent/rapidjson/issues/718. The operator
> implementation is most certainly not legal, but previous versions of
> the compiler may have been ignoring that due to not being asked to
> instantiate the specific method.
> This was fixed 8 years ago, apparently bundled deps in
> socket.io-client-cpp are even older.

Yeah, basically what rapidjson does is something like
using size_t = decltype (sizeof 0);                                             
                                                                                
                      
template <typename T>                                                           
                                                                                
                      
struct S {                                                                      
                                                                                
                      
  template <size_t N>                                                           
                                                                                
                      
  S (const T (&str)[N]) : s (str), length (N - 1) {}                            
                                                                                
                      
  S (const T *str, size_t len) : s (str), length (len) {}                       
                                                                                
                      
  S (const S &rhs) : s (rhs.s), length (rhs.length) {}                          
                                                                                
                      
  S &operator= (const S &rhs) { s = rhs.s; length = rhs.length; }               
                                                                                
                      
  const T *const s;                                                             
                                                                                
                      
  const size_t length;                                                          
                                                                                
                      
};                                                                              
                                                                                
                      
and gcc only diagnoses that starting with https://gcc.gnu.org/r14-4111
when operator= doesn't need to be instantiated (C++ generally allows
but doesn't require such diagnostics on uninstantiated always invalid
templates), though only for the length store, the s store is invalid
too but it has a dependent type in that case.

        Jakub
--
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to