[Bug libstdc++/71780] std::map::operator[] crashes with std::vector of objects used as key

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jul 7 00:14:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71780

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
N.B. it doesn't matter that you're using map<vector<Small>, int> rather than
map<Small, int> directly, because the comparisons on the vector use the
comparisons on the Small type, so an invalid ordering for Small produces an
invalid ordering for SmallVec too.

This still fails:

  std::vector<Small> va(1, a), vb(1, b);
  assert( ! ((va < vb) && (vb < va)) );


More information about the Gcc-bugs mailing list