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

Moritz Sichert sichert@in.tum.de
Tue Mar 23 17:45:09 GMT 2021


Thank you!

You are right. The idea was that the test also tests the const overloads of begin() and end() of reverse_view. But the view concept requires movable. Maybe, this should just be

static_assert(std::ranges::range<const decltype(v)>);

instead?

The test in the patch now has the same static_assert twice.

Am 23.03.21 um 18:09 schrieb Jonathan Wakely:
> 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: smime.p7s
Type: application/pkcs7-signature
Size: 5622 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20210323/ef7d35ae/attachment.p7s>


More information about the Gcc-patches mailing list