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
Undefined behavior when deep copying from and to an empty unmanaged view #1967
Comments
I understand what the new behavior is and I like it more than the old one. That said: we probably should just allow deep copies between zero length views. |
Yeah I had a short look. We will look at it in more detail in our team meeting in 10 mins. |
Decided this is correct, it mirrors std::copy behavior. |
@crtrott wrote:
The closest analog is ranges copy. If you give copy an empty range, it correctly copies nothing: |
I disagree. I just looked in libc++ and sure |
@dalg24 you misunderstood me. "this" referred to this pull request. I.e. we decided this pull request implements the correct behaviour. We had some discussion about whether or not a copy between a default constructed view and a non-default constructed view should be allowed but said yeah its ok because in the end its going to mirror std::copy. |
So we are just waiting for some spot-check to be done by us and then merge it in. |
Just for practice, I'll forestall potential objections by language lawyering :D [iterator.requirements.general] (link)
The range |
This can occur for unmanaged views (non-zero rank) because
std::memcpy()
gets called with a null pointer.It is a bit tricky because the behavior depends on whether deprecated code is disabled or not.
I am working on a patch. Will follow up on this.
The text was updated successfully, but these errors were encountered: