libstdc++: Make string_view::copy usable in constant expressions (PR 94498)
authorJonathan Wakely <jwakely@redhat.com>
Mon, 6 Apr 2020 17:30:53 +0000 (18:30 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Mon, 6 Apr 2020 17:30:53 +0000 (18:30 +0100)
commitb696698767ba45b4d61a93205167e2f1f744d3f1
tree068e11fdb6ef1ff4afee270cb736915edf46b344
parentf84aded848f6fdd2704c9376263c6d1aee6bb0ca
libstdc++: Make string_view::copy usable in constant expressions (PR 94498)

PR libstdc++/94498
* include/bits/char_traits.h (__gnu_cxx::char_traits::move): Make it
usable in constant expressions for C++20.
(__gnu_cxx::char_traits::copy, __gnu_cxx::char_traits::assign): Add
_GLIBCXX20_CONSTEXPR.
(std::char_traits<char>, std::char_traits<wchar_t>)
(std::char_traits<char8_t>): Make move, copy and assign usable in
constant expressions for C++20.
(std::char_traits<char16_t>, std::char_traits<char32_t>): Make move
and copy usable in constant expressions for C++20.
* include/std/string_view (basic_string_view::copy): Add
_GLIBCXX20_CONSTEXPR.
* testsuite/21_strings/basic_string_view/operations/copy/char/
constexpr.cc: New test.
* testsuite/21_strings/basic_string_view/operations/copy/wchar_t/
constexpr.cc: New test.
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/char_traits.h
libstdc++-v3/include/std/string_view
libstdc++-v3/testsuite/21_strings/basic_string_view/operations/copy/char/constexpr.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string_view/operations/copy/wchar_t/constexpr.cc [new file with mode: 0644]