Yes, I use an old compiler, but also a new one.
GCC 4.9 (because of my distro's versioning hell) and the very latest clang downloaded from their web.
Code:
$ g++ -std=c++14 -Wall -O3 -pthread zmolly.cpp -o zmolly
zmolly.cpp: In member function ‘void sparse_model_t::update(dense_model_t*, int)’:
zmolly.cpp:418:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (auto i = 0; i + n < m_symbols.size(); i++) {
^
zmolly.cpp: In member function ‘uint32_t matcher_t::lookup(unsigned char*, uint32_t, uint32_t, int, int)’:
zmolly.cpp:674:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (match_len + 1 < next_match_len) {
^
zmolly.cpp: In function ‘void zmolly_encode(std::istream&, std::ostream&)’:
zmolly.cpp:746:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while (orig_pos < orig_size) {
^
zmolly.cpp: In function ‘int main(int, char**)’:
zmolly.cpp:859:86: error: use of deleted function ‘std::basic_ifstream<char>::basic_ifstream(const std::basic_ifstream<char>&)’
auto fin = std::ifstream(std::string() + argv[2], std::ios::in | std::ios::binary);
^
In file included from zmolly.cpp:33:0:
/usr/include/c++/4.9/fstream:430:11: note: ‘std::basic_ifstream<char>::basic_ifstream(const std::basic_ifstream<char>&)’ is implicitly deleted because the default definition would be ill-formed:
class basic_ifstream : public basic_istream<_CharT, _Traits>
^
/usr/include/c++/4.9/fstream:430:11: error: use of deleted function ‘std::basic_istream<char>::basic_istream(const std::basic_istream<char>&)’
In file included from /usr/include/c++/4.9/fstream:38:0,
from zmolly.cpp:33:
/usr/include/c++/4.9/istream:58:11: note: ‘std::basic_istream<char>::basic_istream(const std::basic_istream<char>&)’ is implicitly deleted because the default definition would be ill-formed:
class basic_istream : virtual public basic_ios<_CharT, _Traits>
^
/usr/include/c++/4.9/istream:58:11: error: use of deleted function ‘std::basic_ios<char>::basic_ios(const std::basic_ios<char>&)’
In file included from /usr/include/c++/4.9/ios:44:0,
from /usr/include/c++/4.9/istream:38,
from /usr/include/c++/4.9/fstream:38,
from zmolly.cpp:33:
/usr/include/c++/4.9/bits/basic_ios.h:66:11: note: ‘std::basic_ios<char>::basic_ios(const std::basic_ios<char>&)’ is implicitly deleted because the default definition would be ill-formed:
class basic_ios : public ios_base
^
In file included from /usr/include/c++/4.9/ios:42:0,
from /usr/include/c++/4.9/istream:38,
from /usr/include/c++/4.9/fstream:38,
from zmolly.cpp:33:
/usr/include/c++/4.9/bits/ios_base.h:786:5: error: ‘std::ios_base::ios_base(const std::ios_base&)’ is private
ios_base(const ios_base&);
^
In file included from /usr/include/c++/4.9/ios:44:0,
from /usr/include/c++/4.9/istream:38,
from /usr/include/c++/4.9/fstream:38,
from zmolly.cpp:33:
/usr/include/c++/4.9/bits/basic_ios.h:66:11: error: within this context
class basic_ios : public ios_base
^
In file included from zmolly.cpp:33:0:
/usr/include/c++/4.9/fstream:430:11: error: use of deleted function ‘std::basic_ios<char>::basic_ios(const std::basic_ios<char>&)’
class basic_ifstream : public basic_istream<_CharT, _Traits>
^
/usr/include/c++/4.9/fstream:430:11: error: use of deleted function ‘std::basic_filebuf<char>::basic_filebuf(const std::basic_filebuf<char>&)’
/usr/include/c++/4.9/fstream:72:11: note: ‘std::basic_filebuf<char>::basic_filebuf(const std::basic_filebuf<char>&)’ is implicitly deleted because the default definition would be ill-formed:
class basic_filebuf : public basic_streambuf<_CharT, _Traits>
^
In file included from /usr/include/c++/4.9/ios:43:0,
from /usr/include/c++/4.9/istream:38,
from /usr/include/c++/4.9/fstream:38,
from zmolly.cpp:33:
/usr/include/c++/4.9/streambuf:802:7: error: ‘std::basic_streambuf<_CharT, _Traits>::basic_streambuf(const std::basic_streambuf<_CharT, _Traits>&) [with _CharT = char; _Traits = std::char_traits<char>]’ is private
basic_streambuf(const basic_streambuf& __sb)
^
In file included from zmolly.cpp:33:0:
/usr/include/c++/4.9/fstream:72:11: error: within this context
class basic_filebuf : public basic_streambuf<_CharT, _Traits>
^
zmolly.cpp:866:72: error: use of deleted function ‘std::basic_ofstream<char>::basic_ofstream(const std::basic_ofstream<char>&)’
auto fout = std::ofstream(argv[3], std::ios::out | std::ios::binary);
^
In file included from zmolly.cpp:33:0:
/usr/include/c++/4.9/fstream:602:11: note: ‘std::basic_ofstream<char>::basic_ofstream(const std::basic_ofstream<char>&)’ is implicitly deleted because the default definition would be ill-formed:
class basic_ofstream : public basic_ostream<_CharT,_Traits>
^
/usr/include/c++/4.9/fstream:602:11: error: use of deleted function ‘std::basic_ostream<char>::basic_ostream(const std::basic_ostream<char>&)’
In file included from /usr/include/c++/4.9/istream:39:0,
from /usr/include/c++/4.9/fstream:38,
from zmolly.cpp:33:
/usr/include/c++/4.9/ostream:58:11: note: ‘std::basic_ostream<char>::basic_ostream(const std::basic_ostream<char>&)’ is implicitly deleted because the default definition would be ill-formed:
class basic_ostream : virtual public basic_ios<_CharT, _Traits>
^
/usr/include/c++/4.9/ostream:58:11: error: use of deleted function ‘std::basic_ios<char>::basic_ios(const std::basic_ios<char>&)’
In file included from zmolly.cpp:33:0:
/usr/include/c++/4.9/fstream:602:11: error: use of deleted function ‘std::basic_ios<char>::basic_ios(const std::basic_ios<char>&)’
class basic_ofstream : public basic_ostream<_CharT,_Traits>
^
/usr/include/c++/4.9/fstream:602:11: error: use of deleted function ‘std::basic_filebuf<char>::basic_filebuf(const std::basic_filebuf<char>&)’
zmolly.cpp: In instantiation of ‘zmolly_encode(std::istream&, std::ostream&)::<lambda(auto:1)> [with auto:1 = int*]’:
/usr/include/c++/4.9/type_traits:2195:25: required by substitution of ‘template<class _Fn, class ... _Args> static std::__success_type<decltype (declval<_Fn>()((declval<_Args>)()...))> std::__result_of_other_impl::_S_test(int) [with _Fn = zmolly_encode(std::istream&, std::ostream&)::<lambda(auto:1)>; _Args = {int*}]’
/usr/include/c++/4.9/type_traits:2206:57: required from ‘struct std::__result_of_impl<false, false, zmolly_encode(std::istream&, std::ostream&)::<lambda(auto:1)>, int*>’
/usr/include/c++/4.9/type_traits:2210:12: required from ‘class std::result_of<zmolly_encode(std::istream&, std::ostream&)::<lambda(auto:1)>(int*)>’
/usr/include/c++/4.9/functional:1665:61: required from ‘struct std::_Bind_simple<zmolly_encode(std::istream&, std::ostream&)::<lambda(auto:1)>(int*)>’
/usr/include/c++/4.9/thread:140:47: required from ‘std::thread::thread(_Callable&&, _Args&& ...) [with _Callable = zmolly_encode(std::istream&, std::ostream&)::<lambda(auto:1)>&; _Args = {int*}]’
zmolly.cpp:743:67: required from here
zmolly.cpp:734:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (auto i = 0; i < match_len; i++) {
^
Code:
$ clang++ -std=c++14 -Wall -O3 -pthread zmolly.cpp -o zmolly
zmolly.cpp:859:10: error: call to implicitly-deleted copy constructor of 'std::basic_ifstream<char>'
auto fin = std::ifstream(std::string() + argv[2], std::ios::in | std::ios::binary);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/fstream:430:28: note: copy constructor of 'basic_ifstream<char, std::char_traits<char> >' is implicitly deleted
because base class 'basic_istream<char, std::char_traits<char> >' has a deleted copy constructor
class basic_ifstream : public basic_istream<_CharT, _Traits>
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/istream:58:27: note: copy constructor of 'basic_istream<char, std::char_traits<char> >' is implicitly deleted
because base class 'basic_ios<char, std::char_traits<char> >' has a deleted copy constructor
class basic_istream : virtual public basic_ios<_CharT, _Traits>
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/bits/basic_ios.h:66:23: note: copy constructor of 'basic_ios<char, std::char_traits<char> >' is implicitly
deleted because base class 'std::ios_base' has an inaccessible copy constructor
class basic_ios : public ios_base
^
zmolly.cpp:866:10: error: call to implicitly-deleted copy constructor of 'std::basic_ofstream<char>'
auto fout = std::ofstream(argv[3], std::ios::out | std::ios::binary);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/fstream:602:28: note: copy constructor of 'basic_ofstream<char, std::char_traits<char> >' is implicitly deleted
because base class 'basic_ostream<char, std::char_traits<char> >' has a deleted copy constructor
class basic_ofstream : public basic_ostream<_CharT,_Traits>
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/ostream:58:27: note: copy constructor of 'basic_ostream<char, std::char_traits<char> >' is implicitly deleted
because base class 'basic_ios<char, std::char_traits<char> >' has a deleted copy constructor
class basic_ostream : virtual public basic_ios<_CharT, _Traits>
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/bits/basic_ios.h:66:23: note: copy constructor of 'basic_ios<char, std::char_traits<char> >' is implicitly
deleted because base class 'std::ios_base' has an inaccessible copy constructor
class basic_ios : public ios_base
^
2 errors generated.