2010-08-22 02:59:46 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2010-11-16 23:09:02 +01:00
|
|
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
|
|
// Source Licenses. See LICENSE.TXT for details.
|
2010-08-22 02:59:46 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
// type_traits
|
|
|
|
|
|
|
|
// is_trivial
|
|
|
|
|
|
|
|
#include <type_traits>
|
|
|
|
|
2013-07-04 02:10:01 +02:00
|
|
|
template <class T>
|
|
|
|
void test_is_trivial()
|
|
|
|
{
|
|
|
|
static_assert( std::is_trivial<T>::value, "");
|
|
|
|
static_assert( std::is_trivial<const T>::value, "");
|
|
|
|
static_assert( std::is_trivial<volatile T>::value, "");
|
|
|
|
static_assert( std::is_trivial<const volatile T>::value, "");
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
void test_is_not_trivial()
|
|
|
|
{
|
|
|
|
static_assert(!std::is_trivial<T>::value, "");
|
|
|
|
static_assert(!std::is_trivial<const T>::value, "");
|
|
|
|
static_assert(!std::is_trivial<volatile T>::value, "");
|
|
|
|
static_assert(!std::is_trivial<const volatile T>::value, "");
|
|
|
|
}
|
|
|
|
|
2011-05-13 16:08:16 +02:00
|
|
|
struct A {};
|
|
|
|
|
|
|
|
class B
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
B();
|
|
|
|
};
|
|
|
|
|
2010-08-22 02:59:46 +02:00
|
|
|
int main()
|
|
|
|
{
|
2013-07-04 02:10:01 +02:00
|
|
|
test_is_trivial<int> ();
|
|
|
|
test_is_trivial<A> ();
|
|
|
|
|
|
|
|
test_is_not_trivial<int&> ();
|
|
|
|
test_is_not_trivial<volatile int&> ();
|
|
|
|
test_is_not_trivial<B> ();
|
2010-08-22 02:59:46 +02:00
|
|
|
}
|