This can help flag accidentally passing in negative values into the string_view constructor. This aligns with a similar check in absl::string_view.
Details
- Reviewers
rsmith Mordante - Group Reviewers
Restricted Project - Commits
- rG61363445d46d: [libc++] Assert that lengths fit in difference_type
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
(This is my first time contributing here or using this tool, so let me know if I got something wrong!)
Thanks for your contribution, a few comments.
libcxx/test/libcxx/strings/string.view/assert.ctor.length.pass.cpp | ||
---|---|---|
11–13 | Why is this not supported in these language versions? We have enabled string_view in older language versions. | |
16 | Please add the function's synopsis here, best look for other tests for examples. |
libcxx/test/libcxx/strings/string.view/assert.ctor.length.pass.cpp | ||
---|---|---|
11–13 | Looks like that didn't work because the assertion is only allowed in constexpr starting C++14. I'll make this match the other assert and disable the test in C++11. |
LGTM, but can you reupload this revision to see that it passes the Windows CI, these errors look odd so I like to have a rerun. It seems the exception issue is unrelated.
Can you provide "your name" <your@e.mail> then we can commit on your behalf when the CI is happy.
libcxx/test/libcxx/strings/string.view/assert.ctor.length.pass.cpp | ||
---|---|---|
11–13 | Oke sounds good. | |
16 | Yes thanks! |
Done.
Can you provide "your name" <your@e.mail> then we can commit on your behalf when the CI is happy.
"David Benjamin" <davidben@google.com>
Thanks I just committed this patch on your behalf, feel free to close the bug report.
Why is this not supported in these language versions? We have enabled string_view in older language versions.