|
Boost Users : |
From: Qiang Ren (qiang.ren_at_[hidden])
Date: 2022-01-07 10:45:12
Hi,
I am on ubuntu 20.04, I have GCC9.4 and 10.3 and 11.1 installed.
I found that when set "-std=c++20", with gcc11, boost.gil will failed to build.
Here is the simple test cpp to reproduce the issue:
#include <sstream>
#include <boost/gil.hpp>
#include <boost/gil/extension/io/png.hpp>
namespace gil = boost::gil;
int main()
{
gil::rgb8_image_t img;
std::stringstream buf(std::ios::in | std::ios::out | std::ios::binary);
gil::read_and_convert_image(buf, img, gil::png_tag{});
return 0;
}
the build command is:
g++ -o test test_gcc11_gil.cc -std=c++20 -I${THIRD_PARTY}/boost/boost_1_78_0 -L${THIRD_PARTY}/libpng/1.6.37/lib/ -lpng
If replaced '-std=c++20' with '-std=c++17', the build would be OK, but with 'c++20', gcc 11 failed with the following errors:
In file included from /data/lin/ThirdParty/boost/boost_1_78_0/boost/gil/extension/io/png/read.hpp:13,
from /data/lin/ThirdParty/boost/boost_1_78_0/boost/gil/extension/io/png.hpp:11,
from test_gcc11_gil.cc:3:
/data/lin/ThirdParty/boost/boost_1_78_0/boost/gil/extension/io/png/tags.hpp:576:32: error: expected unqualified-id before ¡®)¡¯ token
576 | image_read_info< png_tag >()
| ^
/data/lin/ThirdParty/boost/boost_1_78_0/boost/gil/extension/io/png/tags.hpp:711:36: error: expected unqualified-id before ¡®)¡¯ token
711 | image_read_settings< png_tag >()
| ^
In file included from /data/lin/ThirdParty/boost/boost_1_78_0/boost/gil/extension/io/png/read.hpp:21,
from /data/lin/ThirdParty/boost/boost_1_78_0/boost/gil/extension/io/png.hpp:11,
from test_gcc11_gil.cc:3:
/data/lin/ThirdParty/boost/boost_1_78_0/boost/gil/io/make_reader.hpp: In instantiation of ¡®typename boost::gil::get_reader<String, FormatTag, ConversionPolicy>::type boost::gil::make_reader(Device&, const FormatTag&, const ConversionPolicy&, typename std::enable_if<typename boost::mp11::detail::mp_and_impl<boost::mp11::mp_list<boost::gil::detail::is_adaptable_input_device<FormatTag, Device, void>, boost::gil::is_format_tag<FormatTag> >, void>::type::value>::type*) [with Device = std::__cxx11::basic_stringstream<char>; FormatTag = boost::gil::png_tag; ConversionPolicy = boost::gil::detail::read_and_convert<boost::gil::default_color_converter>; typename boost::gil::get_reader<String, FormatTag, ConversionPolicy>::type = boost::gil::reader<boost::gil::detail::istream_device<boost::gil::png_tag>, boost::gil::png_tag, boost::gil::detail::read_and_convert<boost::gil::default_color_converter> >; typename std::enable_if<typename boost::mp11::detail::mp_and_impl<boost::mp11::mp_list<boost::gil::detail::is_adaptable_input_device<FormatTag, Device, void>, boost::gil::is_format_tag<FormatTag> >, void>::type::value>::type = void;typename boost::mp11::detail::mp_and_impl<boost::mp11::mp_list<boost::gil::detail::is_adaptable_input_device<FormatTag, Device, void>, boost::gil::is_format_tag<FormatTag> >, void>::type =std::integral_constant<bool, true>]¡¯:
/data/lin/ThirdParty/boost/boost_1_78_0/boost/gil/io/read_and_convert_image.hpp:263:34: required from ¡®void boost::gil::read_and_convert_image(Device&, Image&, const FormatTag&, typename std::enable_if<typename boost::mp11::detail::mp_and_impl<boost::mp11::mp_list<boost::gil::detail::is_read_device<FormatTag, Device, void>, boost::gil::is_format_tag<FormatTag> >, void>::type::value>::type*) [with Device = std::__cxx11::basic_stringstream<char>; Image = boost::gil::image<boost::gil::pixel<unsigned char, boost::gil::layout<boost::mp11::mp_list<boost::gil::red_t, boost::gil::green_t, boost::gil::blue_t> > >, false, std::allocator<unsigned char> >; FormatTag = boost::gil::png_tag; typename std::enable_if<typename boost::mp11::detail::mp_and_impl<boost::mp11::mp_list<boost::gil::detail::is_read_device<FormatTag, Device, void>, boost::gil::is_format_tag<FormatTag> >, void>::type::value>::type = void; typename boost::mp11::detail::mp_and_impl<boost::mp11::mp_list<boost::gil::detail::is_read_device<FormatTag, Device, void>, boost::gil::is_format_tag<FormatTag> >, void>::type = std::integral_constant<bool, true>]¡¯
test_gcc11_gil.cc:11:30: required from here
/data/lin/ThirdParty/boost/boost_1_78_0/boost/gil/io/make_reader.hpp:193:30: error: no matching function for call to ¡®boost::gil::image_read_settings<boost::gil::png_tag>::image_read_settings()¡¯
193 | return make_reader(file, image_read_settings<FormatTag>(), cc);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /data/lin/ThirdParty/boost/boost_1_78_0/boost/gil/extension/io/png/read.hpp:13,
from /data/lin/ThirdParty/boost/boost_1_78_0/boost/gil/extension/io/png.hpp:11,
from test_gcc11_gil.cc:3:
/data/lin/ThirdParty/boost/boost_1_78_0/boost/gil/extension/io/png/tags.hpp:718:5: note: candidate: ¡®boost::gil::image_read_settings<boost::gil::png_tag>::image_read_settings(const point_t&, const point_t&)¡¯
718 | image_read_settings( const point_t& top_left
| ^~~~~~~~~~~~~~~~~~~
/data/lin/ThirdParty/boost/boost_1_78_0/boost/gil/extension/io/png/tags.hpp:718:5: note: candidate expects 2 arguments, 0 provided
/data/lin/ThirdParty/boost/boost_1_78_0/boost/gil/extension/io/png/tags.hpp:707:8: note: candidate: ¡®constexpr boost::gil::image_read_settings<boost::gil::png_tag>::image_read_settings(const boost::gil::image_read_settings<boost::gil::png_tag>&)¡¯
707 | struct image_read_settings< png_tag > : public image_read_settings_base
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/data/lin/ThirdParty/boost/boost_1_78_0/boost/gil/extension/io/png/tags.hpp:707:8: note: candidate expects 1 argument, 0 provided
/data/lin/ThirdParty/boost/boost_1_78_0/boost/gil/extension/io/png/tags.hpp:707:8: note: candidate: ¡®constexpr boost::gil::image_read_settings<boost::gil::png_tag>::image_read_settings(boost::gil::image_read_settings<boost::gil::png_tag>&&)¡¯
/data/lin/ThirdParty/boost/boost_1_78_0/boost/gil/extension/io/png/tags.hpp:707:8: note: candidate expects 1 argument, 0 provided
Only gcc 11 will fail with '-std=c++20', gcc9 and gcc 10 worked fine. I guess that gcc11 has implemented more c++20 features than gcc9 and gcc10.
Since the boost project updates more quickly than gcc, I hope this issue might be fixed in the next boost version.
Thanks,
Qiang Ren
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net