]> 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-2019 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 static_assert(std::is_same<xpmr::u16string,
40 std::basic_string<char16_t, std::char_traits<char16_t>,
41 xpmr::polymorphic_allocator<char16_t>>>::value,
42 "pmr::u16string");
43 static_assert(std::is_same<xpmr::u32string,
44 std::basic_string<char32_t, std::char_traits<char32_t>,
45 xpmr::polymorphic_allocator<char32_t>>>::value,
46 "pmr::u32string");
47
48 #ifdef _GLIBCXX_USE_WCHAR_T
49 static_assert(std::is_same<xpmr::basic_string<wchar_t>,
50 std::basic_string<wchar_t, std::char_traits<wchar_t>,
51 xpmr::polymorphic_allocator<wchar_t>>>::value,
52 "pmr::basic_string<wchar_t>");
53 static_assert(std::is_same<xpmr::basic_string<wchar_t, T>,
54 std::basic_string<wchar_t, T, xpmr::polymorphic_allocator<wchar_t>>>::value,
55 "pmr::basic_string<wchar_t>");
56
57 static_assert(std::is_same<xpmr::wstring,
58 std::basic_string<wchar_t, std::char_traits<wchar_t>,
59 xpmr::polymorphic_allocator<wchar_t>>>::value,
60 "pmr::wstring");
61 #endif