2018-07-25 Jonathan Wakely <jwakely@redhat.com>
+ PR libstdc++/86676
+ * testsuite/20_util/monotonic_buffer_resource/release.cc: Allow for
+ buffer being misaligned and so returned pointer not being at start.
+
* include/experimental/memory_resource: Include <cstddef> header.
* acinclude.m4 (glibcxx_SUBDIRS): Add src/c++17.
unsigned char buffer[1024];
std::pmr::monotonic_buffer_resource mbr(buffer, sizeof(buffer), &r);
void* p = mbr.allocate(800, 16);
- VERIFY( p == buffer );
+ VERIFY( p >= buffer && p < (buffer + 16) );
+ void* const p_in_buffer = p;
VERIFY( r.allocate_calls == 0 );
p = mbr.allocate(300, 1);
VERIFY( p != buffer );
+ VERIFY( p != buffer );
VERIFY( r.allocate_calls == 1 );
mbr.release();
VERIFY( r.deallocate_calls == 1 );
VERIFY( r.number_of_active_allocations() == 0 );
// initial buffer should be used again now:
p = mbr.allocate(1000);
- VERIFY( p == buffer );
+ VERIFY( p == p_in_buffer );
VERIFY( r.allocate_calls == 1 );
}