]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / experimental / polymorphic_allocator / pmr_typedefs_string.cc
1 // Copyright (C) 2018-2022 Free Software Foundation, Inc.
2 //
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
7 // any later version.
8
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
17
18 // { dg-do compile { target c++14 } }
19 // { dg-require-effective-target cxx11_abi }
20
21 #include <experimental/string>
22
23 namespace xpmr = std::experimental::pmr;
24
25 struct T : std::char_traits<char> { };
26
27 static_assert(std::is_same<xpmr::basic_string<char>,
28 std::basic_string<char, std::char_traits<char>,
29 xpmr::polymorphic_allocator<char>>>::value,
30 "pmr::basic_string");
31 static_assert(std::is_same<xpmr::basic_string<char, T>,
32 std::basic_string<char, T, xpmr::polymorphic_allocator<char>>>::value,
33 "pmr::basic_string");
34
35 static_assert(std::is_same<xpmr::string,
36 std::basic_string<char, std::char_traits<char>,
37 xpmr::polymorphic_allocator<char>>>::value,
38 "pmr::string");
39 #ifdef _GLIBCXX_USE_CHAR8_T
40 static_assert(std::is_same<xpmr::u8string,
41 std::basic_string<char8_t, std::char_traits<char8_t>,
42 xpmr::polymorphic_allocator<char8_t>>>::value,
43 "pmr::u8string");
44 #endif
45 static_assert(std::is_same<xpmr::u16string,
46 std::basic_string<char16_t, std::char_traits<char16_t>,
47 xpmr::polymorphic_allocator<char16_t>>>::value,
48 "pmr::u16string");
49 static_assert(std::is_same<xpmr::u32string,
50 std::basic_string<char32_t, std::char_traits<char32_t>,
51 xpmr::polymorphic_allocator<char32_t>>>::value,
52 "pmr::u32string");
53
54 static_assert(std::is_same<xpmr::basic_string<wchar_t>,
55 std::basic_string<wchar_t, std::char_traits<wchar_t>,
56 xpmr::polymorphic_allocator<wchar_t>>>::value,
57 "pmr::basic_string<wchar_t>");
58 static_assert(std::is_same<xpmr::basic_string<wchar_t, T>,
59 std::basic_string<wchar_t, T, xpmr::polymorphic_allocator<wchar_t>>>::value,
60 "pmr::basic_string<wchar_t>");
61
62 static_assert(std::is_same<xpmr::wstring,
63 std::basic_string<wchar_t, std::char_traits<wchar_t>,
64 xpmr::polymorphic_allocator<wchar_t>>>::value,
65 "pmr::wstring");