xref: /aosp_15_r20/external/libcxx/test/std/localization/c.locales/clocale.pass.cpp (revision 58b9f456b02922dfdb1fad8a988d5fd8765ecb80)
1*58b9f456SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
2*58b9f456SAndroid Build Coastguard Worker //
3*58b9f456SAndroid Build Coastguard Worker //                     The LLVM Compiler Infrastructure
4*58b9f456SAndroid Build Coastguard Worker //
5*58b9f456SAndroid Build Coastguard Worker // This file is dual licensed under the MIT and the University of Illinois Open
6*58b9f456SAndroid Build Coastguard Worker // Source Licenses. See LICENSE.TXT for details.
7*58b9f456SAndroid Build Coastguard Worker //
8*58b9f456SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
9*58b9f456SAndroid Build Coastguard Worker 
10*58b9f456SAndroid Build Coastguard Worker // <clocale>
11*58b9f456SAndroid Build Coastguard Worker 
12*58b9f456SAndroid Build Coastguard Worker #include <clocale>
13*58b9f456SAndroid Build Coastguard Worker #include <type_traits>
14*58b9f456SAndroid Build Coastguard Worker 
15*58b9f456SAndroid Build Coastguard Worker #ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
16*58b9f456SAndroid Build Coastguard Worker 
17*58b9f456SAndroid Build Coastguard Worker #ifndef LC_ALL
18*58b9f456SAndroid Build Coastguard Worker #error LC_ALL not defined
19*58b9f456SAndroid Build Coastguard Worker #endif
20*58b9f456SAndroid Build Coastguard Worker 
21*58b9f456SAndroid Build Coastguard Worker #ifndef LC_COLLATE
22*58b9f456SAndroid Build Coastguard Worker #error LC_COLLATE not defined
23*58b9f456SAndroid Build Coastguard Worker #endif
24*58b9f456SAndroid Build Coastguard Worker 
25*58b9f456SAndroid Build Coastguard Worker #ifndef LC_CTYPE
26*58b9f456SAndroid Build Coastguard Worker #error LC_CTYPE not defined
27*58b9f456SAndroid Build Coastguard Worker #endif
28*58b9f456SAndroid Build Coastguard Worker 
29*58b9f456SAndroid Build Coastguard Worker #ifndef LC_MONETARY
30*58b9f456SAndroid Build Coastguard Worker #error LC_MONETARY not defined
31*58b9f456SAndroid Build Coastguard Worker #endif
32*58b9f456SAndroid Build Coastguard Worker 
33*58b9f456SAndroid Build Coastguard Worker #ifndef LC_NUMERIC
34*58b9f456SAndroid Build Coastguard Worker #error LC_NUMERIC not defined
35*58b9f456SAndroid Build Coastguard Worker #endif
36*58b9f456SAndroid Build Coastguard Worker 
37*58b9f456SAndroid Build Coastguard Worker #ifndef LC_TIME
38*58b9f456SAndroid Build Coastguard Worker #error LC_TIME not defined
39*58b9f456SAndroid Build Coastguard Worker #endif
40*58b9f456SAndroid Build Coastguard Worker 
41*58b9f456SAndroid Build Coastguard Worker #endif // !_LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
42*58b9f456SAndroid Build Coastguard Worker 
43*58b9f456SAndroid Build Coastguard Worker #ifndef NULL
44*58b9f456SAndroid Build Coastguard Worker #error NULL not defined
45*58b9f456SAndroid Build Coastguard Worker #endif
46*58b9f456SAndroid Build Coastguard Worker 
main()47*58b9f456SAndroid Build Coastguard Worker int main()
48*58b9f456SAndroid Build Coastguard Worker {
49*58b9f456SAndroid Build Coastguard Worker     std::lconv lc;
50*58b9f456SAndroid Build Coastguard Worker     ((void)lc); // Prevent unused warning
51*58b9f456SAndroid Build Coastguard Worker #ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
52*58b9f456SAndroid Build Coastguard Worker     static_assert((std::is_same<decltype(std::setlocale(0, "")), char*>::value), "");
53*58b9f456SAndroid Build Coastguard Worker #endif
54*58b9f456SAndroid Build Coastguard Worker     static_assert((std::is_same<decltype(std::localeconv()), std::lconv*>::value), "");
55*58b9f456SAndroid Build Coastguard Worker }
56