1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14
10 // UNSUPPORTED: no-localization
11 // TODO: Change to XFAIL once https://github.com/llvm/llvm-project/issues/40340 is fixed
12 // UNSUPPORTED: availability-pmr-missing
16 // namespace std::pmr {
18 // template <class BidirectionalIterator>
19 // using match_results =
20 // std::match_results<BidirectionalIterator,
21 // polymorphic_allocator<sub_match<BidirectionalIterator>>>;
23 // typedef match_results<const char*> cmatch;
24 // typedef match_results<const wchar_t*> wcmatch;
25 // typedef match_results<string::const_iterator> smatch;
26 // typedef match_results<wstring::const_iterator> wsmatch;
28 // } // namespace std::pmr
32 #include <memory_resource>
33 #include <type_traits>
35 #include "test_macros.h"
37 template <class Iter
, class PmrTypedef
>
38 void test_match_result_typedef() {
39 using StdMR
= std::match_results
<Iter
, std::pmr::polymorphic_allocator
<std::sub_match
<Iter
>>>;
40 using PmrMR
= std::pmr::match_results
<Iter
>;
41 static_assert(std::is_same
<StdMR
, PmrMR
>::value
, "");
42 static_assert(std::is_same
<PmrMR
, PmrTypedef
>::value
, "");
45 int main(int, char**) {
47 test_match_result_typedef
<const char*, std::pmr::cmatch
>();
48 test_match_result_typedef
<std::pmr::string::const_iterator
, std::pmr::smatch
>();
49 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
50 test_match_result_typedef
<const wchar_t*, std::pmr::wcmatch
>();
51 test_match_result_typedef
<std::pmr::wstring::const_iterator
, std::pmr::wsmatch
>();
55 // Check that std::match_results has been included and is complete.
57 assert(s
.get_allocator().resource() == std::pmr::get_default_resource());