11468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant//===----------------------------------------------------------------------===// 21468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant// 31468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant// The LLVM Compiler Infrastructure 41468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant// 51468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant// This file is dual licensed under the MIT and the University of Illinois Open 61468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant// Source Licenses. See LICENSE.TXT for details. 71468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant// 81468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant//===----------------------------------------------------------------------===// 91468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant 101468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant// type_traits 111468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant 121468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant// is_nothrow_copy_constructible 131468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant 141468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant#include <type_traits> 151468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant 161468b668aa964beb1220e9b36162b092fb54952bHoward Hinnanttemplate <class T> 171468b668aa964beb1220e9b36162b092fb54952bHoward Hinnantvoid test_is_nothrow_copy_constructible() 181468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant{ 191468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant static_assert( std::is_nothrow_copy_constructible<T>::value, ""); 201468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant static_assert( std::is_nothrow_copy_constructible<const T>::value, ""); 211468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant} 221468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant 231468b668aa964beb1220e9b36162b092fb54952bHoward Hinnanttemplate <class T> 241468b668aa964beb1220e9b36162b092fb54952bHoward Hinnantvoid test_has_not_nothrow_copy_constructor() 251468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant{ 261468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant static_assert(!std::is_nothrow_copy_constructible<T>::value, ""); 271468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant static_assert(!std::is_nothrow_copy_constructible<const T>::value, ""); 281468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant static_assert(!std::is_nothrow_copy_constructible<volatile T>::value, ""); 291468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant static_assert(!std::is_nothrow_copy_constructible<const volatile T>::value, ""); 301468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant} 311468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant 321468b668aa964beb1220e9b36162b092fb54952bHoward Hinnantclass Empty 331468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant{ 341468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant}; 351468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant 361468b668aa964beb1220e9b36162b092fb54952bHoward Hinnantunion Union {}; 371468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant 381468b668aa964beb1220e9b36162b092fb54952bHoward Hinnantstruct bit_zero 391468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant{ 401468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant int : 0; 411468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant}; 421468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant 431468b668aa964beb1220e9b36162b092fb54952bHoward Hinnantstruct A 441468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant{ 451468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant A(const A&); 461468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant}; 471468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant 481468b668aa964beb1220e9b36162b092fb54952bHoward Hinnantint main() 491468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant{ 501468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant test_has_not_nothrow_copy_constructor<void>(); 511468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant test_has_not_nothrow_copy_constructor<A>(); 521468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant 531468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant test_is_nothrow_copy_constructible<int&>(); 541468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant test_is_nothrow_copy_constructible<Union>(); 551468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant test_is_nothrow_copy_constructible<Empty>(); 561468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant test_is_nothrow_copy_constructible<int>(); 571468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant test_is_nothrow_copy_constructible<double>(); 581468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant test_is_nothrow_copy_constructible<int*>(); 591468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant test_is_nothrow_copy_constructible<const int*>(); 601468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant test_is_nothrow_copy_constructible<bit_zero>(); 611468b668aa964beb1220e9b36162b092fb54952bHoward Hinnant} 62