xref: /llvm-project/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/system-header-simulation.h (revision 0e95921bc303a206cc6ae1c21ee90ec223bf9e78)
1 #pragma clang system_header
2 
3 namespace std {
4 
5 template<class T, T v>
6 struct integral_constant {
7     static constexpr T value = v;
8     typedef T value_type;
9     typedef integral_constant type;
value_typeintegral_constant10     constexpr operator value_type() const noexcept { return value; }
11 };
12 
13 template <bool B>
14 using bool_constant = integral_constant<bool, B>;
15 using true_type = bool_constant<true>;
16 using false_type = bool_constant<false>;
17 
18 template<class T>
19 struct is_error_code_enum : false_type {};
20 
21 template <class T>
22 void swap(T &a, T &b);
23 
24 enum class io_errc {
25   stream = 1,
26 };
27 
28 template <class... Types>
29 class tuple;
30 
31 template <typename T = void>
32 class less;
33 
34 template <>
35 class less<void> {
36 public:
37   template <typename T, typename U>
operator()38   bool operator()(T &&Lhs, U &&Rhs) const {
39     return static_cast<T &&>(Lhs) < static_cast<U &&>(Rhs);
40   }
41   template <typename A, typename B = int>
42   struct X {};
43 };
44 
45 template <class Key>
46 struct hash;
47 
48 template <class T>
49 class numeric_limits;
50 
51 struct Outer {
52   struct Inner {};
53 };
54 
55 namespace detail {
56 struct X {};
57 } // namespace detail
58 
59 } // namespace std
60 
61 // Template specializations that are in a system-header file.
62 // The purpose is to test cert-dcl58-cpp (no warnings here).
63 namespace std {
64 template <>
65 void swap<short>(short &, short &){};
66 
67 template <>
68 struct is_error_code_enum<short> : true_type {};
69 
70 template <>
71 bool less<void>::operator()<short &&, short &&>(short &&, short &&) const {
72   return false;
73 }
74 
75 template <>
76 struct less<void>::X<short> {};
77 } // namespace std
78