mateidavid/zstr

Incompatible with GCC 4.8.2

GuillaumeHolley opened this issue · 5 comments

Hi,

I recently started playing with zstr in one of my projects and I noticed the library does not compile with GCC 4.8.2. I know that GCC 4.8.2 is reaaaaally old now, I think almost 10 years old, but unfortunately my users also use very old compilers...

Anyway, here is the issue (one issue at 2 places):

zstr.hpp: In member function ‘void zstr::ifstream::open(std::string, std::ios_base::openmode)’:
zstr.hpp:429:31: error: use of deleted function ‘std::basic_istream<char>& std::basic_istream<char>::operator=(const std::basic_istream<char>&)’
         std::istream::operator=(std::istream(new istreambuf(_fs.rdbuf())));

zstr.hpp: In member function ‘void zstr::ofstream::open(std::string, std::ios_base::openmode, int)’:
zstr.hpp:467:31: error: use of deleted function ‘std::basic_ostream<char>& std::basic_ostream<char>::operator=(const std::basic_ostream<char>&)’
         std::ostream::operator=(std::ostream(new ostreambuf(_fs.rdbuf(), default_buff_size, level)));

If I compile with GCC 5.4.0 everything is fine. Would there be any way to work around that?

Thank you,
Guillaume

Hi Guillaume, you will need at least GCC 5.1:
https://stackoverflow.com/questions/43088414/error-use-of-deleted-function-stdbasic-ofstreamchar-stdbasic-ofstreamc
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53626

@CMurtagh-LGTM could you provide an alternative version for GCC<5 ?

#ifdef __GNUC__
#  include <features.h>
#  if __GNUC_PREREQ(5,1)
   //operator=...
#  else
   //alternative version...
#  endif
#endif

but unfortunately my users also use very old compilers...

An alternative for the moment would be to tell them to use this git commit: afa0ae1
or maybe v1.0.4 or older: https://github.com/mateidavid/zstr/releases

Hi @ferdymercury,

Thank you for the feedback. It seems that the easiest thing to do is to increase my compiler requirement from GCC 4.8 to GCC 5.1 which shouldn't be a big deal. There is the other solution which is to use an older version of zstr but right now, I like option 1 better.

Guillaume

It looks like this is mostly resolved, let me know if you still want me to do the patch.

Hi @CMurtagh-LGTM,

It's all good for me, increasing my requirement to GCC 5.1 is not that big of a deal. Thanks!