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 //===----------------------------------------------------------------------===//
10 // UNSUPPORTED: no-localization
12 // XFAIL: availability-aligned_allocation-missing
14 // <experimental/regex>
16 // namespace std { namespace experimental { namespace 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::experimental::pmr
30 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
32 #include <experimental/regex>
33 #include <type_traits>
36 #include "test_macros.h"
38 namespace pmr
= std::experimental::pmr
;
40 template <class Iter
, class PmrTypedef
>
41 void test_match_result_typedef() {
42 using StdMR
= std::match_results
<Iter
, pmr::polymorphic_allocator
<std::sub_match
<Iter
>>>;
43 using PmrMR
= pmr::match_results
<Iter
>;
44 static_assert(std::is_same
<StdMR
, PmrMR
>::value
, "");
45 static_assert(std::is_same
<PmrMR
, PmrTypedef
>::value
, "");
51 test_match_result_typedef
<const char*, pmr::cmatch
>();
52 test_match_result_typedef
<pmr::string::const_iterator
, pmr::smatch
>();
53 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
54 test_match_result_typedef
<const wchar_t*, pmr::wcmatch
>();
55 test_match_result_typedef
<pmr::wstring::const_iterator
, pmr::wsmatch
>();
59 // Check that std::match_results has been included and is complete.
61 assert(s
.get_allocator().resource() == pmr::get_default_resource());