enforce "non-array trivial standard-layout" for basic_string and basic_string_view (#1262)

This commit is contained in:
Igor Zhukov 2020-09-05 08:53:39 +07:00 коммит произвёл GitHub
Родитель 4f72f78574
Коммит be0441cda1
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 8 добавлений и 6 удалений

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

@ -1209,6 +1209,10 @@ public:
"Bad char_traits for basic_string_view; "
"N4659 24.4.2 [string.view.template]/1 \"the type traits::char_type shall name the same type as charT.\"");
static_assert(!is_array_v<_Elem> && is_trivial_v<_Elem> && is_standard_layout_v<_Elem>,
"The character type of basic_string_view must be a non-array trivial standard-layout type. See N4861 "
"[strings.general]/1.");
using traits_type = _Traits;
using value_type = _Elem;
using pointer = _Elem*;
@ -2290,6 +2294,10 @@ private:
"N4659 24.3.2.1 [string.require]/3 requires that the supplied "
"char_traits character type match the string's character type.");
static_assert(!is_array_v<_Elem> && is_trivial_v<_Elem> && is_standard_layout_v<_Elem>,
"The character type of basic_string must be a non-array trivial standard-layout type. See N4861 "
"[strings.general]/1.");
public:
using traits_type = _Traits;
using allocator_type = _Alloc;

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

@ -551,9 +551,6 @@ std/containers/sequences/array/array.data/data_const.pass.cpp FAIL
std/containers/sequences/array/array.data/data.pass.cpp FAIL
std/containers/sequences/array/iterators.pass.cpp FAIL
# STL bug: string_view doesn't enforce "non-array trivial standard-layout", related to LWG-3034.
std/strings/string.view/char.bad.fail.cpp:0 FAIL
# Predicate count assertions - IDL2 is slightly bending the Standard's rules here.
std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp FAIL
std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp FAIL

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

@ -551,9 +551,6 @@ containers\sequences\array\array.data\data_const.pass.cpp
containers\sequences\array\array.data\data.pass.cpp
containers\sequences\array\iterators.pass.cpp
# STL bug: string_view doesn't enforce "non-array trivial standard-layout", related to LWG-3034.
strings\string.view\char.bad.fail.cpp
# Predicate count assertions - IDL2 is slightly bending the Standard's rules here.
algorithms\alg.sorting\alg.heap.operations\make.heap\make_heap_comp.pass.cpp
algorithms\alg.sorting\alg.merge\inplace_merge_comp.pass.cpp