https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97407
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2020-10-13
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This was reduced from https://wandbox.org/permlink/MGJIbRbNtWQeNDWq which was
posted at
https://www.reddit.com/r/cpp/comments/j9ndx1/increased_complexity_of_c20_range_algorithms/g8ktca8
#include <algorithm>
#include <iostream>
#include <iterator>
#include <ranges>
#include <vector>
struct Package {
double weight;
double price;
void foo() {}
};
int main(){
std::vector<Package> packages {
{100.0, 10.0},
{104.0, 7.5},
{95.0, 17.5},
{91.0, 15.0},
{100.1, 12.5 },
};
std::ranges::sort(packages, {}, &Package::foo);
}
The errors for this include the unwanted expansion of iterator_t using the
unrelated "_Container" name, but in this case the name _Container is never even
explained!
/opt/wandbox/gcc-head/include/c++/11.0.0/bits/iterator_concepts.h: In
substitution of 'template<class _Range, class _Comp, class _Proj> requires
(random_access_range<_Range>) &&
(sortable<decltype(std::__detail::__ranges_begin((declval<_Container&>)())),
_Comp, _Proj>) constexpr std::ranges::borrowed_iterator_t<_Range>
std::ranges::__sort_fn::operator()(_Range&&, _Comp, _Proj) const [with _Range =
std::vector<Package>&; _Comp = std::ranges::less; _Proj = void
(Package::*)()]':
prog.cc:22:50: required from here
The name _Container does not appear in the [with ...] list of template
arguments.