-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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_like
from MSVC STL to libc++, we add more checks: https://reviews.llvm.org/D132327Clang has a new warning if
std::move
used withoutstd
Check
constexpr bool test()
in runtime too, not only compile time.Add all combinations of
const
and&&
forconstexpr bool test()
Add a test to ensure that
std::forward_like
doesn't use copy/ctor/default constructorsAdd a test with the same type.