[PATCH] Add some extra checks to the MoveOnly test class to ensure it is not constructed or assigned from in a moved-from state.

David Blaikie dblaikie at gmail.com
Thu Jul 24 08:21:31 PDT 2014


>>! In D4095#4, @mclow.lists wrote:
> What's the general motivation for these changes?

Honestly it's been so long since I sent this I've lost most of my context, but it was mostly motivated by bugs I found in SmallVector that, while not existent in libc++'s std::vector, weren't tested either.

> What errors do you expect these asserts to find?

This helps cover cases where container resizing is performed in an order that invalidates the to-be-added elements before they're inserted into the sequence. I don't know of any bugs in std::vector for this case, but I've seen SmallVector bugs (which I haven't got around to fixing) that this would catch.

Somewhat related to http://reviews.llvm.org/D4088 (similar test coverage, but in D4095 the tests were already there, it's just that the move-only type wasn't verifying certain behavior so it could've silently passed with the same sort of bugs)

I can go back & try to reproduce the particular valid cases that are buggy in SmallVector and non-buggy but untested in std::vector, if you'd like.

http://reviews.llvm.org/D4095






More information about the cfe-commits mailing list