[PATCH] libstdc++: Avoid accidental ADL when calling make_reverse_iterator

Jonathan Wakely jwakely@redhat.com
Tue Mar 23 17:09:07 GMT 2021


On 23/03/21 16:25 +0000, Jonathan Wakely wrote:
>On 03/03/21 20:26 +0100, Moritz Sichert via Libstdc++ wrote:
>>Thanks for the review. I attached the updated patch.
>>
>>Can you commit this for me or point me to what I should do next? This is my first contribution here.
>
>I was about to do this, but ...
>
>>+namespace test_ns
>>+{
>>+  struct A {};
>>+  template <typename T>
>>+  void make_reverse_iterator(T&&) {}
>>+} // namespace test_ns
>>+
>>+void test()
>>+{
>>+  test_ns::A as[] = {{}, {}};
>>+  auto v = as | std::views::reverse;
>>+  static_assert(std::ranges::view<decltype(v)>);
>>+  static_assert(std::ranges::view<const decltype(v)>);
>
>Was this tested? A view must be movable, which requires
>move-assignable. You can't assign to a const view, so const
>decltype(v) does not model movable so does not model view.

Here's what I've committed. Thanks for the bugfix.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 3540 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20210323/eb9fbbc7/attachment.bin>


More information about the Libstdc++ mailing list