[LV] Prevent query the computeCost() when VF=1 in emitInvalidCostRemarks(). (#117288)
[llvm-project.git] / libcxx / test / std / localization / locales / locale / locale.cons / copy.pass.cpp
blob04d72f6ffe6e70aaf6ba52fb90eb24ec07fe9563
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 // REQUIRES: locale.fr_FR.UTF-8
11 // XFAIL: availability-char8_t_support-missing
13 // This test runs in C++20, but we have deprecated codecvt<char(16|32), char, mbstate_t> in C++20.
14 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
16 // <locale>
18 // locale(const locale& other) throw();
20 #include <locale>
21 #include <cassert>
22 #include <new>
24 #include "count_new.h"
25 #include "test_macros.h"
26 #include "platform_support.h" // locale name macros
28 template<class CharT>
29 void check_for(const std::locale& loc)
31 assert(std::has_facet<std::collate<CharT> >(loc));
33 assert(std::has_facet<std::ctype<CharT> >(loc));
35 assert((std::has_facet<std::codecvt<CharT, char, std::mbstate_t> >(loc)));
37 assert(std::has_facet<std::moneypunct<CharT> >(loc));
38 assert(std::has_facet<std::money_get<CharT> >(loc));
39 assert(std::has_facet<std::money_put<CharT> >(loc));
41 assert(std::has_facet<std::numpunct<CharT> >(loc));
42 assert(std::has_facet<std::num_get<CharT> >(loc));
43 assert(std::has_facet<std::num_put<CharT> >(loc));
45 assert(std::has_facet<std::time_get<CharT> >(loc));
46 assert(std::has_facet<std::time_put<CharT> >(loc));
48 assert(std::has_facet<std::messages<CharT> >(loc));
51 void check(const std::locale& loc)
53 check_for<char>(loc);
54 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
55 check_for<wchar_t>(loc);
56 #endif
58 assert((std::has_facet<std::codecvt<char16_t, char, std::mbstate_t> >(loc)));
59 assert((std::has_facet<std::codecvt<char32_t, char, std::mbstate_t> >(loc)));
60 #if TEST_STD_VER > 17
61 assert((std::has_facet<std::codecvt<char16_t, char8_t, std::mbstate_t> >(loc)));
62 assert((std::has_facet<std::codecvt<char32_t, char8_t, std::mbstate_t> >(loc)));
63 #endif
66 int main(int, char**)
69 std::locale loc(LOCALE_fr_FR_UTF_8);
70 std::locale loc2 = loc;
71 assert(loc == loc2);
72 check(loc);
73 check(loc2);
75 assert(globalMemCounter.checkOutstandingNewEq(0));
77 return 0;