This was originally part of https://reviews.llvm.org/D46845, but I decided to split it out to clean up the diff. From that patch's description:
In __hash_table, I split up the functions __node_insert_unqiue and __node_insert_multi into 2 parts in order to implement merge. The first part, __node_insert_{multi,unique}_prepare checks to see if a node already is present in the container (as needed), and rehashes the container. This function can forward exceptions, but doesn't mutate the node it's preparing to insert. the __node_insert_{multi,unique}_perform is noexcept, but mutates the pointers in the node to actually insert it into the container. This allows merge to call a _prepare function on a node while it is in the source container, without invalidating anything or losing nodes if an exception is thrown.
Thanks for taking a look!
Erik
This broke certain cases of compilation with mingw-w64 headers, e.g. cases if <random> was included before <set>.
The root cause turned out to be that the mingw-w64 header yvals.h contains #define _C2 1: https://sourceforge.net/p/mingw-w64/mingw-w64/ci/master/tree/mingw-w64-headers/crt/yvals.h#l179
Similar versions of yvals.h from MSVC also contain a similar definition up to as recent as MSVC 2015 (no longer in 2017 though), where it is defined like this:
Given this predecent and the fact that both libcxx and the other platform headers need to cooperate within the namespace of reserved identifiers starting with an underscore, would you consider using a different identifier here?