Skip to content

Commit

Permalink
Add failing test for span comparison, issue #3 (thanks to @chris0e3)
Browse files Browse the repository at this point in the history
span comparison are not up to date with /heterogeneous/ comparisons introduced in p0122r7.
  • Loading branch information
martinmoene committed May 1, 2018
1 parent e3f509d commit eb54ed6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/span.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1054,4 +1054,20 @@ CASE( "make_span(): Allows building from a const container (with_container_t, st

#endif // span_CONFIG_PROVIDE_MAKE_SPAN

// Issues

#include <cassert>

CASE( "[.issue 3]" )
{
static const uint8_t data[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, };

span< const uint8_t > spn( data );

EXPECT( spn[0] == 0 ); // suppress: unused parameter 'lest_env' [-Wunused-parameter]

assert( make_span( data ) == make_span(data) ); // Ok, non-heterogeneous comparison
assert( make_span( data ) == spn ); // Compile error: comparing fixed with dynamic extension
}

// end of file

0 comments on commit eb54ed6

Please sign in to comment.