Fixes https://github.com/llvm/llvm-project/issues/52902
In debug mode during constant evaluation the iterator was never assigend. There seem to be no other instances of this bug.
Differential D116346
[libc++] Fix __wrap_iter copy-assignment in constexpr contexts philnik on Dec 28 2021, 3:50 PM. Authored by
Details
Fixes https://github.com/llvm/llvm-project/issues/52902 In debug mode during constant evaluation the iterator was never assigend. There seem to be no other instances of this bug.
Diff Detail
Event TimelineComment Actions LGTM! I recommend that you use a git commit message that includes either Fixes https://github.com/llvm/llvm-project/issues/52902 or simply Fixes #52902, on a line/paragraph by itself. Comment Actions Since this fixes a bug I'd like to see a regression test. The fix itself seems correct. Comment Actions +1, a test is a good idea. But IIUC, this is code which is not yet "active," in the sense that string::begin is not constexpr yet and so it's not really possible to get a std::string::iterator at constexpr time except by default-constructing one.
Comment Actions
Comment Actions LGTM with one minor suggestion, but please wait for the CI to complete.
|
Before line 57, let's assert ( i1 != i2 );
Notice that this test won't work until std::string becomes constexpr, which is why it's #if'ed out on line 82 below.
...Waitaminute. Since we're still waiting for CI to come back, anyway, could you please investigate why this godbolt (using span instead of string to get its __wrap_iters) does not reproduce the bug? I think it should fail, but I must be missing something.
https://godbolt.org/z/4aGTK79b5