[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / utilities / meta / meta.rel / is_same.pass.cpp
blobdd83f224013179fa5246de996391a4e922eac3e6
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 // type_traits
11 // is_same
13 #include <type_traits>
15 #include "test_macros.h"
17 template <class T, class U>
18 void test_is_same()
20 static_assert(( std::is_same<T, U>::value), "");
21 static_assert((!std::is_same<const T, U>::value), "");
22 static_assert((!std::is_same<T, const U>::value), "");
23 static_assert(( std::is_same<const T, const U>::value), "");
24 #if TEST_STD_VER > 14
25 static_assert(( std::is_same_v<T, U>), "");
26 static_assert((!std::is_same_v<const T, U>), "");
27 static_assert((!std::is_same_v<T, const U>), "");
28 static_assert(( std::is_same_v<const T, const U>), "");
29 #endif
32 template <class T, class U>
33 void test_is_same_ref()
35 static_assert((std::is_same<T, U>::value), "");
36 static_assert((std::is_same<const T, U>::value), "");
37 static_assert((std::is_same<T, const U>::value), "");
38 static_assert((std::is_same<const T, const U>::value), "");
39 #if TEST_STD_VER > 14
40 static_assert((std::is_same_v<T, U>), "");
41 static_assert((std::is_same_v<const T, U>), "");
42 static_assert((std::is_same_v<T, const U>), "");
43 static_assert((std::is_same_v<const T, const U>), "");
44 #endif
47 template <class T, class U>
48 void test_is_not_same()
50 static_assert((!std::is_same<T, U>::value), "");
53 template <class T>
54 struct OverloadTest
56 void fn(std::is_same<T, int>) { }
57 void fn(std::false_type) { }
58 void x() { fn(std::false_type()); }
61 class Class
63 public:
64 ~Class();
67 int main(int, char**)
69 test_is_same<int, int>();
70 test_is_same<void, void>();
71 test_is_same<Class, Class>();
72 test_is_same<int*, int*>();
73 test_is_same_ref<int&, int&>();
75 test_is_not_same<int, void>();
76 test_is_not_same<void, Class>();
77 test_is_not_same<Class, int*>();
78 test_is_not_same<int*, int&>();
79 test_is_not_same<int&, int>();
81 OverloadTest<char> t;
82 (void)t;
84 return 0;