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 // type_traits
11 
12 // is_trivial
13 
14 #include <type_traits>
15 
16 template <class T>
test_is_trivial()17 void test_is_trivial()
18 {
19     static_assert( std::is_trivial<T>::value, "");
20     static_assert( std::is_trivial<const T>::value, "");
21     static_assert( std::is_trivial<volatile T>::value, "");
22     static_assert( std::is_trivial<const volatile T>::value, "");
23 }
24 
25 template <class T>
test_is_not_trivial()26 void test_is_not_trivial()
27 {
28     static_assert(!std::is_trivial<T>::value, "");
29     static_assert(!std::is_trivial<const T>::value, "");
30     static_assert(!std::is_trivial<volatile T>::value, "");
31     static_assert(!std::is_trivial<const volatile T>::value, "");
32 }
33 
34 struct A {};
35 
36 class B
37 {
38 public:
39     B();
40 };
41 
main()42 int main()
43 {
44     test_is_trivial<int> ();
45     test_is_trivial<A> ();
46 
47     test_is_not_trivial<int&> ();
48     test_is_not_trivial<volatile int&> ();
49     test_is_not_trivial<B> ();
50 }
51