I was tree sheriff last Friday, and some broken bots led Victor and me to a very interesting part of Chromium's code.
memcpy(new_item, static_cast<void*>(item), max_size_for_derived_class);
That is... possibly OK if the type is trivially-copyable. So
as an experiment I put in a static assert to verify it was so. And hundreds of lines of the unit test then failed. So I commented out each unit test that failed to compile because of the new requirement for trivial copyability. And it compiled fine.
So on one hand, we don't seem to be shipping any code that relies on undefined C++. On the other hand, the unit tests for that code are full of code that exercises the code that we do ship in a way that makes it clear that the intention is to handle non-trivially-copyable types.
Can one of you, C++ peeps, take a look at the code? Is there a fix that you can do to the ListContainer to make it able to fulfill the requirements of the unit tests and the other expectations of the code without having it be undefined?
Thanks!
Avi