This patch adds a move constructor to __compressed_pair so that move-only elements of nested compressed pairs (such as a move-only deleter in a std::shared_ptr) can be move-constructed.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 40005 Build 40079: arc lint + arc unit
Event Timeline
I don't know how much we care to fix that. But if we do, does = default work instead?
I would have also expected = default to work but, it doesn't seem to. I think because __compressed_pair inherits from both its elements instead of storing them as members.
Yes, we care to fix that for D62274.
You need to default it in both bases and in the compressed pair itself.
Yes, we care to fix that for D62274.
I don't think we care about move-only types in C++03.
Also, did you test this change? Because adding a move constructor to compressed pair suppresses the copy constructor and make the type always move only.
You need to default it in both bases and in the compressed pair itself.
Yes, you're right. That fixed it.
I don't think we care about move-only types in C++03.
Depends if we want to resolve 2802 in C++03. I think we do, if for no other reason than we don't want to have half a dozen more #ifndef blocks.
Also, did you test this change? Because adding a move constructor to compressed pair suppresses the copy constructor and make the type always move only.
It seemed to pass the memory tests. I also defaulted the copy constructor so, that shouldn't be an issue anymore.
This sounds reasonable to me, however = default is not going to work in C++03 (unless there's a Clang extension I'm not aware of). @zoecarver Do you still need this?
I think I originally created this as a precursor to D62274. But, I don't think it's needed anymore.