On 16 April 2018 at 21:08, Jonathan Wakely wrote:
> On 16 April 2018 at 20:52, François Dumont wrote:
>> Hi
>>
>>     While working on something else on libstdc++ I started having a test
>> failing because of the missing comma overload protection in deque.tcc. So I
>> looked for other similar places in the code and here is a patch to fix the
>> places I found.
>>
>>     Let me know if it is still time to commit.
>
> The changes look right, but please add new tests to demonstrate the
> code that used to fail.
>
> You can use <testsuite_iterators.h> because the iterator types defined
> in there have deleted comma operators that should cause errors in
> these places.

Something like this (but in four separate tests):

#include <deque>
#include <list>
#include <vector>
#include <testsuite_iterators.h>

int main()
{
  using namespace __gnu_test;
  int a[1] = {};
  test_container<int, input_iterator_wrapper> t(a, a+1);

  std::deque<int> d;
  d.assign(t.begin(), t.end());

  std::list<int> l;
  l.assign(t.begin(), t.end());

  std::vector<int> v;
  v.assign(t.begin(), t.end());

  std::vector<bool> b;
  b.assign(t.begin(), t.end());
}


Given how rare it is for real code to overload the comma operator, and
that nobody has reported these bugs, I think this can wait for after
GCC 8.

Reply via email to