[Bug c++/59655] incorrect diagnostic on templatized function with lambda parameter

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Dec 10 16:43:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59655

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2019-03-08 00:00:00         |2019-12-10

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This is now blocking the implementation of std::ranges algorithms, because this
error is given for types that are only used in concept satisfaction (and never
actually odr-used):


#include <iterator>

template<typename T,
         std::indirect_unary_predicate<std::projected<T*, std::identity>> Pred>
  constexpr void
  all_of(T*, Pred)
  { }

void
test01()
{
  struct X { };
  X x;
  all_of(&x, [](X&) { return false; });
}

Compiled with -std=gnu++2a and current trunk:

In file included from
/home/jwakely/gcc/10/include/c++/10.0.0/bits/stl_iterator_base_types.h:71,
                 from /home/jwakely/gcc/10/include/c++/10.0.0/iterator:61,
                 from proj.cc:1:
/home/jwakely/gcc/10/include/c++/10.0.0/bits/iterator_concepts.h:669:40: error:
'std::indirect_result_t<_Proj&, _Iter> std::projected<_Iter,
_Proj>::operator*() const [with _Iter = test01()::X*; _Proj = std::identity;
std::indirect_result_t<_Proj&, _Iter> = test01()::X&]', declared using local
type 'test01()::X', is used but never defined [-fpermissive]
  669 |       indirect_result_t<_Proj&, _Iter> operator*() const; // not
defined
      |                                        ^~~~~~~~


More information about the Gcc-bugs mailing list