Tests: Prepare for P2251 (trivially copyable `span`/`basic_string_view`) (#2015)

This commit is contained in:
Daniel Marshall 2021-06-29 22:32:41 +01:00 коммит произвёл GitHub
Родитель aaa5d08964
Коммит 934a39ec18
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -79,8 +79,8 @@ static_assert(ranges::enable_borrowed_range<span<int>>);
static_assert(ranges::enable_borrowed_range<span<int, 3>>);
#endif // __cpp_lib_concepts
// For performance, our implementation provides an additional guarantee beyond the Standard
// that span and its iterator types are trivially copyable.
// We provide non-standard guarantees that span and its iterator types are trivially copyable;
// P2251 may eventually standardize that guarantee for span itself.
static_assert(is_trivially_copyable_v<span<int>>);
static_assert(is_trivially_copyable_v<span<int>::iterator>);
static_assert(is_trivially_copyable_v<span<int, 3>>);

Просмотреть файл

@ -67,6 +67,11 @@ const evil_conversion_to_string_view_lvalue_only convert_lvalue_only{};
#pragma clang diagnostic pop
#endif // __clang__
// We provide a non-standard guarantee that basic_string_view is trivially copyable;
// P2251 may eventually standardize that guarantee.
static_assert(is_trivially_copyable_v<string_view>);
static_assert(is_trivially_copyable_v<wstring_view>);
// noexcept assertions:
// (functions that explicitly throw have their throws tested and therefore have no static_asserts)
static_assert(noexcept(string_view{}), "default constructor not noexcept");