iod icon indicating copy to clipboard operation
iod copied to clipboard

GCC 4.9 support

Open Manu343726 opened this issue 7 years ago • 1 comments

With GCC 4.9.3 (debian linux) I get compilation errors related to the lack of copy constructor in std::stringstream:

Scanning dependencies of target di
In file included from /home/manuel-sanchez/Documentos/iod/tests/../iod/json.hh:15:0,
                 from /home/manuel-sanchez/Documentos/iod/tests/deep_merge.cc:4:
/home/manuel-sanchez/Documentos/iod/tests/../iod/json_unicode.hh: In function ‘decltype(auto) iod::wrap_json_input_stream(const iod::stringview&)’:
/home/manuel-sanchez/Documentos/iod/tests/../iod/json_unicode.hh:64:96: error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&)’
   wrap_json_input_stream(const iod::stringview& s) { return std::stringstream(s.to_std_string()); }
                                                                                                ^
In file included from /home/manuel-sanchez/Documentos/iod/tests/../iod/json.hh:9:0,
                 from /home/manuel-sanchez/Documentos/iod/tests/deep_merge.cc:4:
/usr/include/c++/4.9/sstream:502:11: note: ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&)’ is implicitly deleted because the default definition would be ill-formed:
     class basic_stringstream : public basic_iostream<_CharT, _Traits>
           ^
/usr/include/c++/4.9/sstream:502:11: error: use of deleted function ‘std::basic_iostream<char>::basic_iostream(const std::basic_iostream<char>&)’
In file included from /usr/include/c++/4.9/iostream:40:0,
                 from /home/manuel-sanchez/Documentos/iod/tests/deep_merge.cc:1:
/usr/include/c++/4.9/istream:795:11: note: ‘std::basic_iostream<char>::basic_iostream(const std::basic_iostream<char>&)’ is implicitly deleted because the default definition would be ill-formed:
     class basic_iostream
           ^

What I can say from the output is that it seems that for some reason that function is not triggering RVO and the stdlibc++ stream has no move constructor (So the compiler picks the copy ctor instead).

UPDATE: After adding gcc 4.9 to the build matrix I see that the "issue" is just that the library no longer supports GCC 4.9 in its current form.

Do you have plans to maintain compatibility with GCC 4.9?

Manu343726 avatar Mar 14 '18 12:03 Manu343726

It depends on the work it requires,. Could you make it compile on gcc 4.9 already ?

matt-42 avatar Mar 20 '18 17:03 matt-42