libcxx

libcxx mirror with random patches
git clone https://git.neptards.moe/neptards/libcxx.git
Log | Files | Refs

remove_cvref.pass.cpp (1670B)


      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
     11 
     12 // type_traits
     13 
     14 // remove_cvref
     15 
     16 #include <type_traits>
     17 
     18 #include "test_macros.h"
     19 
     20 template <class T, class U>
     21 void test_remove_cvref()
     22 {
     23     static_assert((std::is_same<typename std::remove_cvref<T>::type, U>::value), "");
     24     static_assert((std::is_same<         std::remove_cvref_t<T>,     U>::value), "");
     25 }
     26 
     27 int main()
     28 {
     29     test_remove_cvref<void, void>();
     30     test_remove_cvref<int, int>();
     31     test_remove_cvref<const int, int>();
     32     test_remove_cvref<const volatile int, int>();
     33     test_remove_cvref<volatile int, int>();
     34 
     35 // Doesn't decay
     36     test_remove_cvref<int[3],                 int[3]>();
     37     test_remove_cvref<int const [3],          int[3]>();
     38     test_remove_cvref<int volatile [3],       int[3]>();
     39     test_remove_cvref<int const volatile [3], int[3]>();
     40     test_remove_cvref<void(), void ()>();
     41 
     42     test_remove_cvref<int &, int>();
     43     test_remove_cvref<const int &, int>();
     44     test_remove_cvref<const volatile int &, int>();
     45     test_remove_cvref<volatile int &, int>();
     46 
     47     test_remove_cvref<int*, int*>();
     48     test_remove_cvref<int(int) const, int(int) const>();
     49     test_remove_cvref<int(int) volatile, int(int) volatile>();
     50     test_remove_cvref<int(int)  &, int(int)  &>();
     51     test_remove_cvref<int(int) &&, int(int) &&>();
     52 }