brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · d07a136 Raw
48 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// decay12 13#include <type_traits>14 15#include "test_macros.h"16 17template <class T, class U>18void test_decay()19{20    ASSERT_SAME_TYPE(U, typename std::decay<T>::type);21#if TEST_STD_VER > 1122    ASSERT_SAME_TYPE(U,        std::decay_t<T>);23#endif24}25 26int main(int, char**)27{28    test_decay<void, void>();29    test_decay<int, int>();30    test_decay<const volatile int, int>();31    test_decay<int*, int*>();32    test_decay<int&, int>();33    test_decay<const volatile int&, int>();34    test_decay<int[3], int*>();35    test_decay<const int[3], const int*>();36    test_decay<void(), void (*)()>();37#if TEST_STD_VER > 1138    test_decay<int&&, int>();39    test_decay<const volatile int&&, int>();40    test_decay<int(int) const, int(int) const>();41    test_decay<int(int) volatile, int(int) volatile>();42    test_decay<int(int)  &, int(int)  &>();43    test_decay<int(int) &&, int(int) &&>();44#endif45 46  return 0;47}48