This is an archive of the discontinued LLVM Phabricator instance.

Implement LWG3101 - span's Container constructors need another constraint
ClosedPublic

Authored by mclow.lists on Jan 22 2019, 8:21 AM.

Details

Reviewers
EricWF
ldionne
Summary

See https://wg21.link/LWG3101

Another issue that is due to be voted on in Kona.
Since we have two implementations of span - one for dynamic extents, and one for static, this was simple.

Diff Detail

Event Timeline

mclow.lists created this revision.Jan 22 2019, 8:21 AM
ldionne added inline comments.Jan 22 2019, 8:41 AM
test/std/containers/views/span.cons/container.fail.cpp
72

Why does this fail? Shouldn't this use std::span<int, std::dynamic_extent>::span(Container const&)?

100

Just to make sure I understand -- this is the only test that checks the actual changes in LWG3101, i.e. the removal of support for constructing a statically-sized std::span from a dynamically-sized std::span. Other changes just remove tests that shouldn't be passing (or don't make sense) anymore.

mclow.lists marked 2 inline comments as done.Jan 22 2019, 11:07 AM
mclow.lists added inline comments.
test/std/containers/views/span.cons/container.fail.cpp
72

Because it's an rvalue? Dunno; but if so, that makes all the other tests useless. I will investigate.

100

Correct. I removed all the different combinations of const/non-const etc because I removed the ctor, and left a single test behind to make sure that the ctor is not found.

This LGTM but I'd like to understand the situation I commented on with the rvalue before we commit this.

test/std/containers/views/span.cons/container.fail.cpp
72

I think it should compile because the Container const& will bind to a rvalue (and then the std::span contains a dangling reference).

mclow.lists marked 2 inline comments as done.Jan 22 2019, 12:38 PM
mclow.lists added inline comments.
test/std/containers/views/span.cons/container.fail.cpp
72

If I was creating a span<const int>, then yes, but not a span<int>

Re-gen the diff after I updated the tests based on Louis' comments (see r351887)

mclow.lists marked 3 inline comments as done.Jan 22 2019, 2:48 PM
ldionne accepted this revision.Jan 23 2019, 9:26 AM

LGTM, thanks for the explanation re: the test.

This revision is now accepted and ready to land.Jan 23 2019, 9:26 AM
mclow.lists closed this revision.Feb 25 2019, 10:32 AM

Committed as 354805