47 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// type_traits10 11// remove_reference12 13#include <type_traits>14#include "test_macros.h"15 16template <class T, class U>17void test_remove_reference()18{19 ASSERT_SAME_TYPE(U, typename std::remove_reference<T>::type);20#if TEST_STD_VER > 1121 ASSERT_SAME_TYPE(U, std::remove_reference_t<T>);22#endif23}24 25int main(int, char**)26{27 test_remove_reference<void, void>();28 test_remove_reference<int, int>();29 test_remove_reference<int[3], int[3]>();30 test_remove_reference<int*, int*>();31 test_remove_reference<const int*, const int*>();32 33 test_remove_reference<int&, int>();34 test_remove_reference<const int&, const int>();35 test_remove_reference<int(&)[3], int[3]>();36 test_remove_reference<int*&, int*>();37 test_remove_reference<const int*&, const int*>();38 39 test_remove_reference<int&&, int>();40 test_remove_reference<const int&&, const int>();41 test_remove_reference<int(&&)[3], int[3]>();42 test_remove_reference<int*&&, int*>();43 test_remove_reference<const int*&&, const int*>();44 45 return 0;46}47