Re: Build error with GCC 14, not even a warning in GCC 13

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 16, 2024 at 03:32:14PM -0800, Aleksei Bavshin wrote:
> On Tue, Jan 16, 2024 at 3:07 PM Richard Shaw <hobbes1069@xxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux