STL
STL copied to clipboard
Enable `__cpp_lib_concepts` for EDG, part 1
This PR makes __cpp_lib_concepts defined in C++20 mode for all supported compilers, after adding workarounds for various EDG concepts bugs. I have opened two follow-up PRs for non-essential and largely mechanical clean-ups.
- Part 2 (#4297) replaces
concepts_20_matrixandconcepts_latest_matrixwithusual_20_matrixandusual_latest_matrixrespectively. - Part 3 (#4298) replaces
defined(__cpp_lib_concepts)in preprocessing conditions with_HAS_CXX20, and then eliminates some of them where they are redundant.
Oh wow, this is amazing! Thanks!
/pr review
EDG is failing the new triviality tests in P0323R12_expected added by #4271. We need to merge main, minimize a repro to file, and disable the failing cases. (I'd do this now, but I'd rather sleep.)
- Pushed a source-conflict-free merge with
mainto pick up #4271. - Fully reduced and reported VSO-1949451 "EDG concepts rejects
std::expectedtrying to propagate triviality of assignment operations". - Recorded that in tracking issue #1621.
- Disabled the affected top-level scenarios for EDG in
P0323R12_expected.
They were TrivialityScenario4 "Only destruction and move construction/assignment are trivial" and TrivialityScenario6 "All operations are trivial", revealing @CaseyCarter's deep wisdom in https://github.com/microsoft/STL/pull/4271#issuecomment-1882111249 of testing these scenarios. :heart_eyes_cat:
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.
I've pushed additional commits:
- Attempt to avoid timeouts in
P0896R4_ranges_alg_find_end.- Encountered in the internal test harness, probably because the "checked" compiler consumes more memory.
- Drop "assert bug so we'll notice when it's fixed".
- I know this had worthy intentions, but it's a huge headache when either MSVC or EDG devs are trying to test their fixed compilers.
- Properly detect MSVC, part 1.
- DevCom-10265237 "Parameter pack size mismatch doesn't make the require-expression false (regression)" is an MSVC bug.
- This preprocessor logic is guarding an additional constraint that MSVC needs, so I'm updating the
#endifcomment to^^^ workaround ^^^. - Previously, I believe this code was mentally saying, "we're in concepts code, so we only need to distinguish Clang from MSVC". This is no longer the case. Now we need
!defined(__clang__) && !defined(__EDG__)to prevent EDG from using a workaround that it doesn't need.
- Properly detect MSVC, part 2.
- DevCom-1691516 "
std::vector::emplace_backdoes not work for a class with default initializer" is an MSVC bug. - Curiously, this preprocessor logic was checking only
#ifdef __EDG__to distinguish it from MSVC. (I think it might have been written before Clang supportedconstruct_at()?) - Instead, we need to check
#if defined(__clang__) || defined(__EDG__)and send them to the "no workaround" case. This prevents Clang from using a workaround that it doesn't need.
- DevCom-1691516 "
I have comment cleanups for a followup PR but I didn't want to further randomize this one when it's so close to landing.
:heart_eyes_cat: :tada: :cat2: :rocket: :cake:
Thank you @cpplearner and @CaseyCarter for the massive amount of work needed to get to this long-awaited day!