]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/21_strings/basic_string/types/pmr_typedefs.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 21_strings / basic_string / types / pmr_typedefs.cc
CommitLineData
99dee823 1// Copyright (C) 2018-2021 Free Software Foundation, Inc.
1fc9d0b0
JW
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-options "-std=gnu++17" }
19// { dg-do compile { target c++17 } }
1bc7a28f 20// { dg-require-effective-target cxx11-abi }
1fc9d0b0
JW
21
22#include <string>
23#include <memory_resource>
24
25struct T : std::char_traits<char> { };
26
27static_assert(std::is_same_v<std::pmr::basic_string<char>,
28 std::basic_string<char, std::char_traits<char>,
29 std::pmr::polymorphic_allocator<char>>>);
30static_assert(std::is_same_v<std::pmr::basic_string<char, T>,
31 std::basic_string<char, T, std::pmr::polymorphic_allocator<char>>>);
32
33static_assert(std::is_same_v<std::pmr::string,
34 std::basic_string<char, std::char_traits<char>,
35 std::pmr::polymorphic_allocator<char>>>);
59019b42
TH
36#ifdef _GLIBCXX_USE_CHAR8_T
37static_assert(std::is_same_v<std::pmr::u8string,
38 std::basic_string<char8_t, std::char_traits<char8_t>,
39 std::pmr::polymorphic_allocator<char8_t>>>);
40#endif
1fc9d0b0
JW
41static_assert(std::is_same_v<std::pmr::u16string,
42 std::basic_string<char16_t, std::char_traits<char16_t>,
43 std::pmr::polymorphic_allocator<char16_t>>>);
44static_assert(std::is_same_v<std::pmr::u32string,
45 std::basic_string<char32_t, std::char_traits<char32_t>,
46 std::pmr::polymorphic_allocator<char32_t>>>);
47
48#ifdef _GLIBCXX_USE_WCHAR_T
49static_assert(std::is_same_v<std::pmr::basic_string<wchar_t>,
50 std::basic_string<wchar_t, std::char_traits<wchar_t>,
51 std::pmr::polymorphic_allocator<wchar_t>>>);
52static_assert(std::is_same_v<std::pmr::basic_string<wchar_t, T>,
53 std::basic_string<wchar_t, T, std::pmr::polymorphic_allocator<wchar_t>>>);
54
55static_assert(std::is_same_v<std::pmr::wstring,
56 std::basic_string<wchar_t, std::char_traits<wchar_t>,
57 std::pmr::polymorphic_allocator<wchar_t>>>);
58#endif