[mlir][tensor] fix typo in pad tiling comment
[llvm-project.git] / libcxx / test / std / utilities / meta / meta.trans / meta.trans.ref / add_rvalue_ref.pass.cpp
blobd67db440fa26a682e5d2c8ce5fc9aa25546a5c2c
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 // add_rvalue_reference
12 // If T names a referenceable type then the member typedef type
13 // shall name T&&; otherwise, type shall name T.
15 #include <type_traits>
16 #include "test_macros.h"
18 template <class T, class U>
19 void test_add_rvalue_reference()
21 ASSERT_SAME_TYPE(U, typename std::add_rvalue_reference<T>::type);
22 #if TEST_STD_VER > 11
23 ASSERT_SAME_TYPE(U, std::add_rvalue_reference_t<T>);
24 #endif
27 template <class F>
28 void test_function0()
30 ASSERT_SAME_TYPE(F&&, typename std::add_rvalue_reference<F>::type);
31 #if TEST_STD_VER > 11
32 ASSERT_SAME_TYPE(F&&, std::add_rvalue_reference_t<F>);
33 #endif
36 template <class F>
37 void test_function1()
39 ASSERT_SAME_TYPE(F, typename std::add_rvalue_reference<F>::type);
40 #if TEST_STD_VER > 11
41 ASSERT_SAME_TYPE(F, std::add_rvalue_reference_t<F>);
42 #endif
45 struct Foo {};
47 int main(int, char**)
49 test_add_rvalue_reference<void, void>();
50 test_add_rvalue_reference<int, int&&>();
51 test_add_rvalue_reference<int[3], int(&&)[3]>();
52 test_add_rvalue_reference<int&, int&>();
53 test_add_rvalue_reference<const int&, const int&>();
54 test_add_rvalue_reference<int*, int*&&>();
55 test_add_rvalue_reference<const int*, const int*&&>();
56 test_add_rvalue_reference<Foo, Foo&&>();
58 // LWG 2101 specifically talks about add_rvalue_reference and functions.
59 // The term of art is "a referenceable type", which a cv- or ref-qualified function is not.
60 test_function0<void()>();
61 test_function1<void() const>();
62 test_function1<void() &>();
63 test_function1<void() &&>();
64 test_function1<void() const &>();
65 test_function1<void() const &&>();
67 // But a cv- or ref-qualified member function *is* "a referenceable type"
68 test_function0<void (Foo::*)()>();
69 test_function0<void (Foo::*)() const>();
70 test_function0<void (Foo::*)() &>();
71 test_function0<void (Foo::*)() &&>();
72 test_function0<void (Foo::*)() const &>();
73 test_function0<void (Foo::*)() const &&>();
75 return 0;