rapidcheck icon indicating copy to clipboard operation
rapidcheck copied to clipboard

Compiler error with GCC 11.3: template argument deduction failed

Open carlosgalvezp opened this issue 3 years ago • 0 comments

Hi!

I'm using commit 8fafda42e732164db58003e542196e94a28481f9 of rapidcheck, building on C++14 mode. When trying to bump the compiler to GCC 11.3.0 (from GCC 7.5.0) I get the following compile error:

external/rapidcheck/include/rapidcheck/seq/Create.hpp: In lambda function:
external/rapidcheck/include/rapidcheck/seq/Create.hpp:189:16: error: no matching function for call to 'map(rc::Seq<long unsigned int>, rc::seq::subranges(std::size_t, std::size_t)::<lambda(std::size_t)>::<lambda(std::size_t)>)'
  189 |                        return seq::map(
      |                ^       ~~~~~~~~~~~~~~~~
  190 |                            seq::range<std::size_t>(start, end - rangeSize + 1),
      |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  191 |                            [=](std::size_t rangeStart) {
      |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  192 |                              return std::make_pair(rangeStart,
      |                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  193 |                                                    rangeStart + rangeSize);
      |                                                    ~~~~~~~~~~~~~~~~~~~~~~~~
  194 |                            });
      |                 
external/rapidcheck/include/rapidcheck/seq/Transform.hpp:329:1: note: candidate: 'template<class T, class Mapper> rc::Seq<typename std::decay<typename std::result_of<Mapper(T, ...)>::type>::type> rc::seq::map(rc::Seq<T>, Mapper&&)'
  329 | Seq<Decay<typename rc::compat::return_type<Mapper,T>::type>> map(Seq<T> seq,
      | ^~~
external/rapidcheck/include/rapidcheck/seq/Transform.hpp:329:1: note:   template argument deduction/substitution failed:
external/rapidcheck/include/rapidcheck/seq/Transform.hpp: In substitution of 'template<class T, class Mapper> rc::Seq<typename std::decay<typename std::result_of<Mapper(T, ...)>::type>::type> rc::seq::map(rc::Seq<T>, Mapper&&) [with T = long unsigned int; Mapper = rc::seq::subranges(std::size_t, std::size_t)::<lambda(std::size_t)>::<lambda(std::size_t)>]':
external/rapidcheck/include/rapidcheck/seq/Create.hpp:189:16:   required from here
external/rapidcheck/include/rapidcheck/seq/Transform.hpp:329:1: error: invalid use of incomplete type 'struct std::result_of<rc::seq::subranges(std::size_t, std::size_t)::<lambda(std::size_t)>::<lambda(std::size_t)>(long unsigned int, ...)>'
external/gcc_x86/gcc-install/bin/../lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../../../include/c++/11.3.0/type_traits:2372:36: note: declaration of 'struct std::result_of<rc::seq::subranges(std::size_t, std::size_t)::<lambda(std::size_t)>::<lambda(std::size_t)>(long unsigned int, ...)>'
 2372 |   template<typename _Signature>
      |                                    ^        

This happens when calling the function rc::gen::inRange<int>(0, N).

Do you have any feeling for what might be going on? Thanks!

carlosgalvezp avatar Jun 22 '22 07:06 carlosgalvezp