add test coverage for P2445R1 (std::forward_like)#3072
Conversation
| static_assert(is_same_v<decltype(forward_like<T>(CU{})), CU&&>); | ||
| static_assert(is_same_v<decltype(forward_like<T>(u)), U&&>); | ||
| static_assert(is_same_v<decltype(forward_like<T>(cu)), CU&&>); | ||
| static_assert(is_same_v<decltype(forward_like<T>(std::move(u))), U&&>); |
There was a problem hiding this comment.
Note to other reviewers: I'm not requesting a comment clarifying why we qualify std::move throughout despite using namespace std. Yes, it's unconventional, but I assume this usage will become widespread when we adopt Clang 15 with the new warning about using move unqualified. (No change requested.)
There was a problem hiding this comment.
This warning might be obnoxious/widespread enough that we'll need to silence it in the matrices. (I'm not too worried about omitting _STD in product code, we're pretty good about that.) Still, no objections to doing this for now.
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
|
Thanks for enhancing this test coverage and preventing future bugs! 🐞 ✅ 😹 |
While adding
std::forward_likefrom MSVC STL to libc++, we add more checks: https://reviews.llvm.org/D132327Clang has a new warning if
std::moveused withoutstdCheck
constexpr bool test()in runtime too, not only compile time.Add all combinations of
constand&&forconstexpr bool test()Add a test to ensure that
std::forward_likedoesn't use copy/ctor/default constructorsAdd a test with the same type.