is_trivialially_copyable.pass.cpp revision 6063ec176d5056683d6ddd310c2e3a8f1c7e1b46
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_trivially_copyable 13 14#include <type_traits> 15#include <cassert> 16 17struct A 18{ 19 int i_; 20}; 21 22struct B 23{ 24 int i_; 25 ~B() {assert(i_ == 0);} 26}; 27 28class C 29{ 30public: 31 C(); 32}; 33 34int main() 35{ 36 static_assert( std::is_trivially_copyable<int>::value, ""); 37 static_assert( std::is_trivially_copyable<const int>::value, ""); 38 static_assert(!std::is_trivially_copyable<int&>::value, ""); 39 static_assert( std::is_trivially_copyable<A>::value, ""); 40 static_assert( std::is_trivially_copyable<const A>::value, ""); 41 static_assert(!std::is_trivially_copyable<const A&>::value, ""); 42 static_assert(!std::is_trivially_copyable<B>::value, ""); 43 static_assert( std::is_trivially_copyable<C>::value, ""); 44} 45