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

Scott Kostyshak skostysh at lyx.org
Thu Jan 27 13:09:09 UTC 2022


On Thu, Jan 27, 2022 at 01:04:12PM +0000, José Abílio Matos wrote:
> 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.

Except for that issue does it build with -Werror ?

Scott
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20220127/0c82bc58/attachment.asc>


More information about the lyx-devel mailing list