[PATCH] D57058: Implement LWG3101 - span's Container constructors need another constraint
Marshall Clow via Phabricator
reviews at reviews.llvm.org
Tue Jan 22 12:38:49 PST 2019
mclow.lists marked 2 inline comments as done.
mclow.lists added inline comments.
================
Comment at: test/std/containers/views/span.cons/container.fail.cpp:72
{
std::span<int> s1{IsAContainer<int>()}; // expected-error {{no matching constructor for initialization of 'std::span<int>'}}
std::span<int> s3{NotAContainerNoData<int>()}; // expected-error {{no matching constructor for initialization of 'std::span<int>'}}
----------------
ldionne wrote:
> mclow.lists wrote:
> > ldionne wrote:
> > > Why does this fail? Shouldn't this use `std::span<int, std::dynamic_extent>::span(Container const&)`?
> > Because it's an rvalue? Dunno; but if so, that makes all the other tests useless. I will investigate.
> >
> I think it should compile because the `Container const&` will bind to a rvalue (and then the `std::span` contains a dangling reference).
If I was creating a `span<const int>`, then yes, but not a `span<int>`
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57058/new/
https://reviews.llvm.org/D57058
More information about the libcxx-commits
mailing list