boostorg / gil

Boost.GIL - Generic Image Library | Requires C++14 since Boost 1.80
https://boostorg.github.io/gil
Boost Software License 1.0
178 stars 164 forks source link

g++ 12.1.1 fails to compile Boost.GIL with -std=c++20 #718

Closed aleck099 closed 2 years ago

aleck099 commented 2 years ago

Actual behavior

g++ -std=c++20 -c resize.cpp Output:

In file included from /usr/include/boost/gil/extension/io/jpeg/read.hpp:13,
                 from /usr/include/boost/gil/extension/io/jpeg.hpp:11,
                 from resize.cpp:2:
/usr/include/boost/gil/extension/io/jpeg/tags.hpp:144:35: error: expected unqualified-id before ‘)’ token
  144 |     image_read_settings<jpeg_tag>()
      |                                   ^
In file included from /usr/include/boost/gil/extension/io/jpeg/read.hpp:21:
/usr/include/boost/gil/io/make_reader.hpp: In instantiation of ‘typename boost::gil::get_reader<String, FormatTag, ConversionPolicy>::type boost::gil::make_reader(const String&, const FormatTag&, const ConversionPolicy&, typename std::enable_if<typename boost::mp11::detail::mp_and_impl<boost::mp11::mp_list<detail::is_supported_path_spec<String>, is_format_tag<FormatTag> >, void>::type::value>::type*) [with String = char [9]; FormatTag = jpeg_tag; ConversionPolicy = detail::read_and_no_convert; typename get_reader<String, FormatTag, ConversionPolicy>::type = reader<detail::file_stream_device<jpeg_tag>, jpeg_tag, detail::read_and_no_convert>; typename std::enable_if<typename boost::mp11::detail::mp_and_impl<boost::mp11::mp_list<detail::is_supported_path_spec<String>, is_format_tag<FormatTag> >, void>::type::value>::type = void; typename boost::mp11::detail::mp_and_impl<boost::mp11::mp_list<detail::is_supported_path_spec<String>, is_format_tag<FormatTag> >, void>::type = std::integral_constant<bool, true>]’:
/usr/include/boost/gil/io/read_image.hpp:167:34:   required from ‘void boost::gil::read_image(const String&, Image&, const FormatTag&, typename std::enable_if<typename boost::mp11::detail::mp_and_impl<boost::mp11::mp_list<detail::is_supported_path_spec<String>, is_format_tag<FormatTag>, is_read_supported<typename get_pixel_type<typename Image::view_t>::type, FormatTag> >, void>::type::value>::type*) [with String = char [9]; Image = image<pixel<unsigned char, layout<boost::mp11::mp_list<red_t, green_t, blue_t> > >, false, std::allocator<unsigned char> >; FormatTag = jpeg_tag; typename std::enable_if<typename boost::mp11::detail::mp_and_impl<boost::mp11::mp_list<detail::is_supported_path_spec<String>, is_format_tag<FormatTag>, is_read_supported<typename get_pixel_type<typename Image::view_t>::type, FormatTag> >, void>::type::value>::type = void; typename boost::mp11::detail::mp_and_impl<boost::mp11::mp_list<detail::is_supported_path_spec<String>, is_format_tag<FormatTag>, is_read_supported<typename get_pixel_type<typename Image::view_t>::type, FormatTag> >, void>::type = std::integral_constant<bool, true>; typename get_pixel_type<typename Image::view_t>::type = pixel<unsigned char, layout<boost::mp11::mp_list<red_t, green_t, blue_t> > >; typename Image::view_t = image_view<memory_based_2d_locator<memory_based_step_iterator<pixel<unsigned char, layout<boost::mp11::mp_list<red_t, green_t, blue_t> > >*> > >]’
resize.cpp:16:19:   required from here
/usr/include/boost/gil/io/make_reader.hpp:134:35: error: no matching function for call to ‘boost::gil::image_read_settings<boost::gil::jpeg_tag>::image_read_settings()’
  134 |     return make_reader(file_name, image_read_settings<FormatTag>(), cc);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/boost/gil/extension/io/jpeg/tags.hpp:153:5: note: candidate: ‘boost::gil::image_read_settings<boost::gil::jpeg_tag>::image_read_settings(const boost::gil::point_t&, const boost::gil::point_t&, boost::gil::property_base<J_DCT_METHOD>::type)’
  153 |     image_read_settings( const point_t&        top_left
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/boost/gil/extension/io/jpeg/tags.hpp:153:5: note:   candidate expects 3 arguments, 0 provided
/usr/include/boost/gil/extension/io/jpeg/tags.hpp:141:8: note: candidate: ‘constexpr boost::gil::image_read_settings<boost::gil::jpeg_tag>::image_read_settings(const boost::gil::image_read_settings<boost::gil::jpeg_tag>&)’
  141 | struct image_read_settings< jpeg_tag > : public image_read_settings_base
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/boost/gil/extension/io/jpeg/tags.hpp:141:8: note:   candidate expects 1 argument, 0 provided
/usr/include/boost/gil/extension/io/jpeg/tags.hpp:141:8: note: candidate: ‘constexpr boost::gil::image_read_settings<boost::gil::jpeg_tag>::image_read_settings(boost::gil::image_read_settings<boost::gil::jpeg_tag>&&)’
/usr/include/boost/gil/extension/io/jpeg/tags.hpp:141:8: note:   candidate expects 1 argument, 0 provided

NOTE:

Same bug does not happen with -std=c++11/c++14/c++17, only with -std=c++20 Cannot reproduce on clang

Expected behavior

Successfully compiles

C++ Minimal Working Example

resize.cpp

Environment

sdebionne commented 2 years ago

Duplicate of #616. Should be fixed in 1.80, what version are you using?

aleck099 commented 2 years ago

1.79

mloskot commented 2 years ago

@aleck099 Please, upgrade to 1.80 release or use the current master branch, the fix landed in both https://github.com/boostorg/gil/commit/c9b339e5d0b6a1d121ff9b37ae2d7544c534dc68