1// { dg-options "-std=gnu++11" } 2// { dg-do compile } 3 4// Copyright (C) 2012-2015 Free Software Foundation, Inc. 5// 6// This file is part of the GNU ISO C++ Library. This library is free 7// software; you can redistribute it and/or modify it under the 8// terms of the GNU General Public License as published by the 9// Free Software Foundation; either version 3, or (at your option) 10// any later version. 11// 12// This library is distributed in the hope that it will be useful, 13// but WITHOUT ANY WARRANTY; without even the implied warranty of 14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15// GNU General Public License for more details. 16// 17// You should have received a copy of the GNU General Public License along 18// with this library; see the file COPYING3. If not see 19// <http://www.gnu.org/licenses/>. 20 21#include <type_traits> 22#include <initializer_list> 23#include <testsuite_tr1.h> 24 25using namespace __gnu_test::destruct; 26 27// is_nothrow_destructible: 28static_assert(std::is_nothrow_destructible<int>::value, "Error"); 29static_assert(std::is_nothrow_destructible<const int>::value, "Error"); 30static_assert(std::is_nothrow_destructible<const volatile int>::value, "Error"); 31static_assert(std::is_nothrow_destructible<int[12]>::value, "Error"); 32static_assert(std::is_nothrow_destructible<const int[12]>::value, "Error"); 33static_assert(std::is_nothrow_destructible<const volatile int[12]>::value, "Error"); 34static_assert(std::is_nothrow_destructible<decltype(nullptr)>::value, "Error"); 35static_assert(std::is_nothrow_destructible<std::initializer_list<int>>::value, "Error"); 36static_assert(std::is_nothrow_destructible<std::initializer_list<decltype(nullptr)>>::value, "Error"); 37static_assert(std::is_nothrow_destructible<std::initializer_list<TD1>>::value, "Error"); 38static_assert(std::is_nothrow_destructible<std::initializer_list<TD2>>::value, "Error"); 39static_assert(std::is_nothrow_destructible<E>::value, "Error"); 40static_assert(std::is_nothrow_destructible<const E>::value, "Error"); 41static_assert(std::is_nothrow_destructible<const volatile E>::value, "Error"); 42static_assert(std::is_nothrow_destructible<NTD1>::value, "Error"); 43static_assert(std::is_nothrow_destructible<NTD2>::value, "Error"); 44static_assert(std::is_nothrow_destructible<NTD3>::value, "Error"); 45static_assert(std::is_nothrow_destructible<Aggr>::value, "Error"); 46static_assert(std::is_nothrow_destructible<U1>::value, "Error"); 47static_assert(std::is_nothrow_destructible<void(*)()>::value, "Error"); 48static_assert(std::is_nothrow_destructible<void*>::value, "Error"); 49static_assert(std::is_nothrow_destructible<int&>::value, "Error"); 50static_assert(std::is_nothrow_destructible<TD1&>::value, "Error"); 51static_assert(std::is_nothrow_destructible<TD2&>::value, "Error"); 52static_assert(std::is_nothrow_destructible<TD1*>::value, "Error"); 53static_assert(std::is_nothrow_destructible<TD2*>::value, "Error"); 54static_assert(std::is_nothrow_destructible<void(&)()>::value, "Error"); 55static_assert(std::is_nothrow_destructible<void(&&)()>::value, "Error"); 56static_assert(std::is_nothrow_destructible<En>::value, "Error"); 57static_assert(std::is_nothrow_destructible<En*>::value, "Error"); 58static_assert(std::is_nothrow_destructible<En&>::value, "Error"); 59static_assert(std::is_nothrow_destructible<En2>::value, "Error"); 60static_assert(std::is_nothrow_destructible<En2*>::value, "Error"); 61static_assert(std::is_nothrow_destructible<En2&>::value, "Error"); 62static_assert(std::is_nothrow_destructible<TD1(&)(Aggr2, TD2)>::value, "Error"); 63static_assert(std::is_nothrow_destructible<TD1(*)(Aggr2, TD2)>::value, "Error"); 64static_assert(std::is_nothrow_destructible<Abstract1>::value, "Error"); 65static_assert(std::is_nothrow_destructible<Der>::value, "Error"); 66static_assert(std::is_nothrow_destructible<Del&>::value, "Error"); 67static_assert(std::is_nothrow_destructible<Del2&>::value, "Error"); 68static_assert(std::is_nothrow_destructible<Del3&>::value, "Error"); 69static_assert(std::is_nothrow_destructible<Del(&)[1]>::value, "Error"); 70static_assert(std::is_nothrow_destructible<Del2(&)[2]>::value, "Error"); 71static_assert(std::is_nothrow_destructible<Del3(&)[3]>::value, "Error"); 72static_assert(std::is_nothrow_destructible<Del&&>::value, "Error"); 73static_assert(std::is_nothrow_destructible<Del2&&>::value, "Error"); 74static_assert(std::is_nothrow_destructible<Del3&>::value, "Error"); 75static_assert(std::is_nothrow_destructible<Del(&&)[1]>::value, "Error"); 76static_assert(std::is_nothrow_destructible<Del2(&&)[2]>::value, "Error"); 77static_assert(std::is_nothrow_destructible<Del3(&&)[3]>::value, "Error"); 78static_assert(std::is_nothrow_destructible<Ut&>::value, "Error"); 79static_assert(std::is_nothrow_destructible<Ut&&>::value, "Error"); 80static_assert(std::is_nothrow_destructible<Ut*>::value, "Error"); 81static_assert(std::is_nothrow_destructible<Abstract2&>::value, "Error"); 82static_assert(std::is_nothrow_destructible<Abstract3&>::value, "Error"); 83static_assert(std::is_nothrow_destructible<Abstract2*>::value, "Error"); 84static_assert(std::is_nothrow_destructible<Abstract3*>::value, "Error"); 85 86static_assert(!std::is_nothrow_destructible<void>::value, "Error"); 87static_assert(!std::is_nothrow_destructible<const void>::value, "Error"); 88static_assert(!std::is_nothrow_destructible<void()>::value, "Error"); 89static_assert(!std::is_nothrow_destructible<void() const>::value, "Error"); 90static_assert(!std::is_nothrow_destructible<TD1(Aggr2, TD2)>::value, "Error"); 91static_assert(!std::is_nothrow_destructible<int[]>::value, "Error"); 92static_assert(!std::is_nothrow_destructible<const int[]>::value, "Error"); 93static_assert(!std::is_nothrow_destructible<const volatile int[]>::value, "Error"); 94static_assert(!std::is_nothrow_destructible<int[][123]>::value, "Error"); 95static_assert(!std::is_nothrow_destructible<TD1>::value, "Error"); 96static_assert(!std::is_nothrow_destructible<TD2>::value, "Error"); 97static_assert(!std::is_nothrow_destructible<Aggr2>::value, "Error"); 98static_assert(!std::is_nothrow_destructible<Aggr2[1]>::value, "Error"); 99static_assert(!std::is_nothrow_destructible<TD1[1][2]>::value, "Error"); 100static_assert(!std::is_nothrow_destructible<Ut>::value, "Error"); 101static_assert(!std::is_nothrow_destructible<Ut[3]>::value, "Error"); 102static_assert(!std::is_nothrow_destructible<AbstractDelDtor>::value, "Error"); 103static_assert(!std::is_nothrow_destructible<Abstract2>::value, "Error"); 104static_assert(!std::is_nothrow_destructible<Abstract3>::value, "Error"); 105static_assert(!std::is_nothrow_destructible<Der2>::value, "Error"); 106static_assert(!std::is_nothrow_destructible<Del>::value, "Error"); 107static_assert(!std::is_nothrow_destructible<Del2>::value, "Error"); 108static_assert(!std::is_nothrow_destructible<Del3>::value, "Error"); 109static_assert(!std::is_nothrow_destructible<Del[1]>::value, "Error"); 110static_assert(!std::is_nothrow_destructible<Del2[2]>::value, "Error"); 111static_assert(!std::is_nothrow_destructible<Del3[3]>::value, "Error"); 112 113