llvm-project/libcxx/test/std/containers/views/span.elem
Louis Dionne 0a0e0afaa0 [libc++] span: Fix incorrect static asserts
The static asserts in span<T, N>::front() and span<T, N>::back() are
incorrect as they may be triggered from valid code due to evaluation
of a never taken branch:

    span<int, 0> foo;
    if (!foo.empty()) {
        auto x = foo.front();
    }

The problem is that the branch is always evaluated by the compiler,
creating invalid compile errors for span<T, 0>.

Thanks to Michael Schellenberger Costa for the patch.

Differential Revision: https://reviews.llvm.org/D71995
2020-02-14 14:32:41 +01:00
..
back.pass.cpp [libc++] span: Fix incorrect static asserts 2020-02-14 14:32:41 +01:00
data.pass.cpp Support tests in freestanding 2019-02-04 20:31:13 +00:00
front.pass.cpp [libc++] span: Fix incorrect static asserts 2020-02-14 14:32:41 +01:00
op_idx.pass.cpp [libc++][P1872] span should have size_type, not index_type. 2019-11-14 09:07:05 -05:00