Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / experimental / memory / memory.resource.aliases / header_regex_synop.pass.cpp
blobc650c870db01dc4c124cd2dee7835a25f1b5f175
1 //===----------------------------------------------------------------------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03
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>
34 #include <cassert>
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, "");
48 int main(int, char**)
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>();
56 #endif
59 // Check that std::match_results has been included and is complete.
60 pmr::smatch s;
61 assert(s.get_allocator().resource() == pmr::get_default_resource());
64 return 0;