Failure to compile with gcc-12 (2.3.x)

José Abílio Matos jamatos at lyx.org
Thu Jan 27 13:04:12 UTC 2022


Hi,
  we are at the time of year again. :-)

The gcc project will release version 12 and in Fedora we are rebuilding all 
packages with it.

There is a failure to build 2.3.x (e.g. on x86-54):
https://kojipkgs.fedoraproject.org//work/tasks/4412/81984412/build.log

   73 | class MatchString : public binary_function<Paragraph, pos_type, int>
      |                            ^~~~~~~~~~~~~~~
In file included from /usr/include/c++/12/string:48,
                 from support/strfwd.h:42,
                 from lyxfind.h:19,
                 from lyxfind.cpp:17:
/usr/include/c++/12/bits/stl_function.h:131:12: note: declared here
  131 |     struct binary_function
      |            ^~~~~~~~~~~~~~~
lyxfind.cpp: In function 'bool lyx::{anonymous}::regex_replace(const std::string&, std::string&, const std::string&, const std::string&)':
lyxfind.cpp:677:9: error: 'ostream_iterator' was not declared in this scope
  677 |         ostream_iterator<char, char> it(oss);
      |         ^~~~~~~~~~~~~~~~
lyxfind.cpp:55:1: note: 'std::ostream_iterator' is defined in header '<iterator>'; did you forget to '#include <iterator>'?
   54 | #include "support/regex.h"
  +++ |+#include <iterator>
   55 | 
lyxfind.cpp:677:26: error: expected primary-expression before 'char'
  677 |         ostream_iterator<char, char> it(oss);
      |                          ^~~~
lyxfind.cpp:678:28: error: 'it' was not declared in this scope; did you mean 't'?
  678 |         lyx::regex_replace(it, s.begin(), s.end(), e, replacestr);
      |                            ^~
      |                            t
This seems an example of a missing include, and g++ even suggests to add:
#include <iterator>

Is there are better fix or is this OK?

I will start to build 2.4 with g++-12 as well FWIW.

Best regards,
-- 
José Abílio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20220127/9c02bae4/attachment.html>


More information about the lyx-devel mailing list