Skip to content
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

<type_traits>: Investigate remaining issues with the _Cond_res workaround #2860

Closed
StephanTLavavej opened this issue Jul 13, 2022 · 1 comment · Fixed by #2863
Closed

<type_traits>: Investigate remaining issues with the _Cond_res workaround #2860

StephanTLavavej opened this issue Jul 13, 2022 · 1 comment · Fixed by #2863
Labels
compiler Compiler work involved fixed Something works now, yay!

Comments

@StephanTLavavej
Copy link
Member

StephanTLavavej commented Jul 13, 2022

We have a workaround for DevCom-876860 / internal VSO-1049320:

STL/stl/inc/type_traits

Lines 1268 to 1294 in 969b2e2

#if !defined(__EDG__) && !defined(__clang__) // TRANSITION, DevCom-876860
template <class _Ty1, class _Ty2>
using _Cond_res_if_right = // N4810 [meta.trans.other]/2.4
decltype(false ? _Returns_exactly<_Ty1>() : _Returns_exactly<_Ty2>());
template <class _Ty>
using _Is_scalar_or_array = disjunction<is_scalar<_Ty>, is_array<_Ty>>;
template <class _Ty1, class _Ty2, class = void>
struct _Cond_res_workaround {};
template <class _Ty1, class _Ty2>
struct _Cond_res_workaround<_Ty1, _Ty2, void_t<_Cond_res_if_right<_Ty1, _Ty2>>> {
using _Uty = remove_cvref_t<_Ty1>;
using type = conditional_t<conjunction_v<is_same<_Uty, remove_cvref_t<_Ty2>>, _Is_scalar_or_array<_Uty>,
disjunction<conjunction<is_lvalue_reference<_Ty1>, is_rvalue_reference<_Ty2>>,
conjunction<is_rvalue_reference<_Ty1>, is_lvalue_reference<_Ty2>>>>,
decay_t<_Copy_cv<remove_reference_t<_Ty1>, remove_reference_t<_Ty2>>>, _Cond_res_if_right<_Ty1, _Ty2>>;
};
template <class _Ty1, class _Ty2>
using _Cond_res = typename _Cond_res_workaround<_Ty1, _Ty2>::type;
#else // ^^^ workaround / no workaround vvv
template <class _Ty1, class _Ty2>
using _Cond_res = // N4810 [meta.trans.other]/2.4
decltype(false ? _Returns_exactly<_Ty1>() : _Returns_exactly<_Ty2>());
#endif // ^^^ no workaround ^^^

This was resolved as fixed by internal MSVC-PR-382810 on 2022-03-01 (which is certainly available now). However, attempting to remove this workaround still causes a test failure with VS 2022 17.3 Preview 3. We should investigate and report this problem.

The affected libcxx test is std/concepts/concepts.lang/concept.commonref/common_reference.compile.pass.cpp.

@StephanTLavavej StephanTLavavej added help wanted Extra attention is needed compiler Compiler work involved labels Jul 13, 2022
@StephanTLavavej
Copy link
Member Author

@CaseyCarter has offered to take a look at this since he enjoys changing bug numbers in comments so much 🐞 😻

@StephanTLavavej StephanTLavavej removed the help wanted Extra attention is needed label Jul 13, 2022
CaseyCarter added a commit to CaseyCarter/STL that referenced this issue Jul 14, 2022
The workaround for DevCom-876860 is now a workaround for DevCom-10095944. Progress!

Fixes microsoft#2860
@StephanTLavavej StephanTLavavej added the fixed Something works now, yay! label Jul 21, 2022
@CaseyCarter CaseyCarter removed their assignment Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler Compiler work involved fixed Something works now, yay!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants