-
Notifications
You must be signed in to change notification settings - Fork 13.3k
libc++ makes wrong assumptions in std::pair constructor #65620
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
Comments
From #65907 (comment) by @huixie90 , the fix seems pretty simple. @huixie90 Do you want to take this? |
I think this is an obvious candidate for cherry-picking back to LLVM 17. We will miss 17.0.0, but we should still cherry-pick to |
Fixes llvm#65620 GitHub Issue: llvm#65620 The helper function `__pair_like_explicit_wknd` is only SFINAE-ed with `tuple_size<remove_cvref_t<_PairLike>>::value == 2`, but its function body assumes `std::get` being valid https://github.com/llvm/llvm-project/blame/main/libcxx/include/__utility/pair.h#L280
…on (llvm#66585) The helper function `__pair_like_explicit_wknd` is only SFINAE-ed with `tuple_size<remove_cvref_t<_PairLike>>::value == 2`, but its function body assumes `std::get` being valid. Fixes llvm#65620
/cherry-pick 054f9c5 |
/cherry-pick 054f9c5 |
/branch llvm/llvm-project-release-prs/issue65620 |
1 similar comment
/branch llvm/llvm-project-release-prs/issue65620 |
/pull-request llvm/llvm-project-release-prs#702 |
/cherry-pick 054f9c5 (trying to get the CI to behave) |
/branch llvm/llvm-project-release-prs/issue65620 |
…on (llvm#66585) The helper function `__pair_like_explicit_wknd` is only SFINAE-ed with `tuple_size<remove_cvref_t<_PairLike>>::value == 2`, but its function body assumes `std::get` being valid. Fixes llvm#65620
…on (llvm#66585) The helper function `__pair_like_explicit_wknd` is only SFINAE-ed with `tuple_size<remove_cvref_t<_PairLike>>::value == 2`, but its function body assumes `std::get` being valid. Fixes llvm#65620
With latest libc++ this code doesn't compile in clang with
-std=c++23
.As far as I can tell, when checking wether
kvp
is nothrow move constructible, the compiler tries instantiating thisstd::pair
constructor( https://github.com/llvm/llvm-project/blob/main/libcxx/include/__utility/pair.h#L286-L291 ).That in turn tries to compile this code (https://github.com/llvm/llvm-project/blob/main/libcxx/include/__utility/pair.h#L279-L282), which assumes that
std::tuple_size<T>::value == 2
means thatstd::get<0>(T)
andstd::get<1>(T)
will work.For context, in the original code this type had
get
overloads in its own namespace, but not in namespacestd
.The text was updated successfully, but these errors were encountered: