is_pod.pass.cpp revision c52f43e72dfcea03037729649da84c23b3beb04a
1//===----------------------------------------------------------------------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// type_traits
11
12// is_pod
13
14#include <type_traits>
15
16template <class T>
17void test_is_pod()
18{
19    static_assert( std::is_pod<T>::value, "");
20    static_assert( std::is_pod<const T>::value, "");
21    static_assert( std::is_pod<volatile T>::value, "");
22    static_assert( std::is_pod<const volatile T>::value, "");
23}
24
25template <class T>
26void test_is_not_pod()
27{
28    static_assert(!std::is_pod<T>::value, "");
29    static_assert(!std::is_pod<const T>::value, "");
30    static_assert(!std::is_pod<volatile T>::value, "");
31    static_assert(!std::is_pod<const volatile T>::value, "");
32}
33
34class Class
35{
36public:
37    ~Class();
38};
39
40int main()
41{
42    test_is_not_pod<void>();
43    test_is_not_pod<int&>();
44    test_is_not_pod<Class>();
45
46    test_is_pod<int>();
47    test_is_pod<double>();
48    test_is_pod<int*>();
49    test_is_pod<const int*>();
50    test_is_pod<char[3]>();
51    test_is_pod<char[3]>();
52}
53