This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [v3 PATCH] PR libstdc++/78389


On Fri, Jan 13, 2017 at 9:26 AM, Ville Voutilainen
<ville.voutilainen@gmail.com> wrote:
> Update patch with splices for __carry added. Hopefully this resolves
> the remaining concerns that we had.

On rereading the patch today, the size calculation for merge() appears
to be backwards. [__first2, __last2) consists of the nodes not
transferred into *this, so the new size of __x should be __dist while
this->size() should be incremented by (__orig_size - __dist).

While the original test case in the patch passes (because __dist
happens to be 4 and __orig_size happens to be 8), I see the following
minimally modified test case failing on Wandbox:

  std::list<int> a{1, 2, 3, 4};
  std::list<int> b{5, 6, 7, 8, 9, 10, 11, 12};
  try {
    a.merge(b, ThrowingComparator{4});
  } catch (...) {
  }
  assert(a.size() == std::distance(a.begin(), a.end()) && b.size() ==
std::distance(b.begin(), b.end()));

Sorry for not spotting this earlier.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]