This commit adds std::make_unique_for_overwrite.
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thanks a lot for the patch! Do you think you could update the patch with the rest of the paper too? I'm fine reviewing it all in one patch (actually I find it easier to validate that the whole paper is implemented that way).
Also, I don't see any feature test macro in the paper -- can you confirm that's the case, and that we're not forgetting to add one?
libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.create/make_unique_for_overwrite.array2.compile.fail.cpp | ||
---|---|---|
10–11 ↗ | (On Diff #300522) | You don't need these includes (here and elsewhere). |
libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.create/make_unique_for_overwrite.array3.compile.fail.cpp | ||
14 ↗ | (On Diff #300522) | Can you make these tests be .verify.cpp instead, and check for the error message? |
I looked at it, but I realized I needed to implement P0674R1 as a prereq for the make_shared_for_overwrite array bits, which looked more involved than trying to implement all 3 papers in one go
Also, I don't see any feature test macro in the paper -- can you confirm that's the case, and that we're not forgetting to add one?
There is a feature test macro, but because I did not implement the make_shared_for_overwrite parts
Apply feedback on review
- Remove unused includes
- Use .verify.cpp to check expected error
Arrays in std::shared_ptr is https://reviews.llvm.org/D62641. I've been meaning to review it forever but never get the time to get into it fully. If you'd like, please consider taking a first pass at it.
I'm personally fine taking small bits of a paper.
I would rather it than have a full implementation get stuck in review.
This patch LGTM apart from the negative compilation tests. I suspect those can be SFINAE tests instead.
libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.create/make_unique_for_overwrite.array2.compile.verify.cpp | ||
---|---|---|
13 | Can we not write positive compilation tests for this? Using things like is_invocable? Negative compilation tests should be the last resort. |
After talking to @ldionne, the negative compilation tests aren't inappropriate here. I'm happy to see the stay.
Restrict verify tests to C++20
We do not expose std::make_unique_for_overwrite on pre-C++20 builds, so we will
not get the expected error message.
The test failures look like unrelated tests with flakes.
@ldionne: Do you want to get patch for P0674R1 reviewed first and I can turn this into a complete implementation of P1020/P1973 or should we land the partial implementation?
We've been working hard to fix some underlying issues in std::shared_ptr first. We'll do that, and then get to this patch. It's on my radar, don't worry, it's just that the mess we needed to fix before we get to this ended up being larger than expected.
It's coming together. The review is basically done but Zoe's trying to figure out a few CI failures related to the change. If you wanted, you could probably cherry-pick https://reviews.llvm.org/D62641 locally and base your work on top of that.
@mumbleskates @ckennelly Late is better than never. I think this should be unblocked if we want to implement the full paper now.
Can we not write positive compilation tests for this? Using things like is_invocable?
Negative compilation tests should be the last resort.