Commit 123c516a by Paolo Carlini

[multiple changes]

2011-04-13  Daniel Krugler  <daniel.kruegler@googlemail.com>
	    Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/48526
	* include/std/type_traits (struct is_constructible): Re-implement,
	according to n3290.
	(struct is_default_constructible): Add.
	(struct is_destructible): Likewise.
	(struct __and_, __or_, __not_): Add and use throughout; reorder some
	facilities, other minor tweaks.
	* testsuite/util/testsuite_tr1.h: Add test types.
	* testsuite/20_util/is_constructible/value-2.cc: New.
	* testsuite/20_util/is_default_constructible/value.cc: Likewise.
	* testsuite/20_util/is_default_constructible/requirements/typedefs.cc:
	Likewise.
	* testsuite/20_util/is_default_constructible/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/20_util/is_destructible/value.cc: Likewise.
	* testsuite/20_util/is_destructible/requirements/typedefs.cc:
	Likewise.
	* testsuite/20_util/is_destructible/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust
	dg-error line numbers.
	* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
	Likewise.
	* testsuite/20_util/declval/requirements/1_neg.cc: Likewise.
	* testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Likewise.

2011-04-13  Paolo Carlini  <paolo.carlini@oracle.com>

	* testsuite/20_util/is_function/value.cc: Add, adapted from the tr
	testsuite. 
	* testsuite/20_util/is_function/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/is_function/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/20_util/is_function/24808.cc: Likewise.
	* testsuite/20_util/is_function/35637.cc: Likewise.
	* testsuite/20_util/is_object/value.cc: Likewise.
	* testsuite/20_util/is_object/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/is_object/requirements/explicit_instantiation.cc:
	: Likewise.
	* testsuite/20_util/is_object/24808.cc: Likewise.
	* testsuite/20_util/is_compound/value.cc: Likewise.
	* testsuite/20_util/is_compound/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/is_compound/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/20_util/is_member_object_pointer/value.cc: Likewise.
	* testsuite/20_util/is_member_object_pointer/requirements/
	typedefs.cc: Likewise.
	* testsuite/20_util/is_member_object_pointer/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/20_util/is_fundamental/value.cc: Likewise.
	* testsuite/20_util/is_fundamental/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/is_fundamental/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/20_util/is_member_pointer/value.cc: Likewise.
	* testsuite/20_util/is_member_pointer/requirements/typedefs.cc: 
	Likewise.
	* testsuite/20_util/is_member_pointer/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/20_util/is_member_function_pointer/value.cc: Likewise.
	* testsuite/20_util/is_member_function_pointer/
	requirements/typedefs.cc: Likewise.
	* testsuite/20_util/is_member_function_pointer/requirements/
	explicit_instantiation.cc: Likewise.

	* testsuite/20_util/is_convertible/value.cc: Minor tweak, adjust
	Copyright years.

From-SVN: r172401
parent 12e05824
2011-04-13 Daniel Krugler <daniel.kruegler@googlemail.com>
Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/48526
* include/std/type_traits (struct is_constructible): Re-implement,
according to n3290.
(struct is_default_constructible): Add.
(struct is_destructible): Likewise.
(struct __and_, __or_, __not_): Add and use throughout; reorder some
facilities, other minor tweaks.
* testsuite/util/testsuite_tr1.h: Add test types.
* testsuite/20_util/is_constructible/value-2.cc: New.
* testsuite/20_util/is_default_constructible/value.cc: Likewise.
* testsuite/20_util/is_default_constructible/requirements/typedefs.cc:
Likewise.
* testsuite/20_util/is_default_constructible/requirements/
explicit_instantiation.cc: Likewise.
* testsuite/20_util/is_destructible/value.cc: Likewise.
* testsuite/20_util/is_destructible/requirements/typedefs.cc:
Likewise.
* testsuite/20_util/is_destructible/requirements/
explicit_instantiation.cc: Likewise.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust
dg-error line numbers.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
Likewise.
* testsuite/20_util/declval/requirements/1_neg.cc: Likewise.
* testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Likewise.
2011-04-13 Paolo Carlini <paolo.carlini@oracle.com>
* testsuite/20_util/is_function/value.cc: Add, adapted from the tr
testsuite.
* testsuite/20_util/is_function/requirements/typedefs.cc: Likewise.
* testsuite/20_util/is_function/requirements/
explicit_instantiation.cc: Likewise.
* testsuite/20_util/is_function/24808.cc: Likewise.
* testsuite/20_util/is_function/35637.cc: Likewise.
* testsuite/20_util/is_object/value.cc: Likewise.
* testsuite/20_util/is_object/requirements/typedefs.cc: Likewise.
* testsuite/20_util/is_object/requirements/explicit_instantiation.cc:
: Likewise.
* testsuite/20_util/is_object/24808.cc: Likewise.
* testsuite/20_util/is_compound/value.cc: Likewise.
* testsuite/20_util/is_compound/requirements/typedefs.cc: Likewise.
* testsuite/20_util/is_compound/requirements/
explicit_instantiation.cc: Likewise.
* testsuite/20_util/is_member_object_pointer/value.cc: Likewise.
* testsuite/20_util/is_member_object_pointer/requirements/
typedefs.cc: Likewise.
* testsuite/20_util/is_member_object_pointer/requirements/
explicit_instantiation.cc: Likewise.
* testsuite/20_util/is_fundamental/value.cc: Likewise.
* testsuite/20_util/is_fundamental/requirements/typedefs.cc: Likewise.
* testsuite/20_util/is_fundamental/requirements/
explicit_instantiation.cc: Likewise.
* testsuite/20_util/is_member_pointer/value.cc: Likewise.
* testsuite/20_util/is_member_pointer/requirements/typedefs.cc:
Likewise.
* testsuite/20_util/is_member_pointer/requirements/
explicit_instantiation.cc: Likewise.
* testsuite/20_util/is_member_function_pointer/value.cc: Likewise.
* testsuite/20_util/is_member_function_pointer/
requirements/typedefs.cc: Likewise.
* testsuite/20_util/is_member_function_pointer/requirements/
explicit_instantiation.cc: Likewise.
* testsuite/20_util/is_convertible/value.cc: Minor tweak, adjust
Copyright years.
2011-04-12 Takaya Saito <gintensubaru@gmail.com>
PR libstdc++/48476
......
......@@ -19,7 +19,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// { dg-error "static assertion failed" "" { target *-*-* } 1134 }
// { dg-error "static assertion failed" "" { target *-*-* } 1523 }
#include <utility>
......
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct is_compound<test_type>;
}
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
//
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
void test01()
{
// Check for required typedefs
typedef std::is_compound<int> test_type;
typedef test_type::value_type value_type;
typedef test_type::type type;
typedef test_type::type::value_type type_value_type;
typedef test_type::type::type type_type;
}
// { dg-options "-std=gnu++0x" }
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_hooks.h>
#include <testsuite_tr1.h>
void test01()
{
bool test __attribute__((unused)) = true;
using std::is_compound;
using namespace __gnu_test;
VERIFY( (test_category<is_compound, void>(false)) );
VERIFY( (test_category<is_compound, char>(false)) );
VERIFY( (test_category<is_compound, signed char>(false)) );
VERIFY( (test_category<is_compound, unsigned char>(false)) );
#ifdef _GLIBCXX_USE_WCHAR_T
VERIFY( (test_category<is_compound, wchar_t>(false)) );
#endif
VERIFY( (test_category<is_compound, short>(false)) );
VERIFY( (test_category<is_compound, unsigned short>(false)) );
VERIFY( (test_category<is_compound, int>(false)) );
VERIFY( (test_category<is_compound, unsigned int>(false)) );
VERIFY( (test_category<is_compound, long>(false)) );
VERIFY( (test_category<is_compound, unsigned long>(false)) );
VERIFY( (test_category<is_compound, long long>(false)) );
VERIFY( (test_category<is_compound, unsigned long long>(false)) );
VERIFY( (test_category<is_compound, float>(false)) );
VERIFY( (test_category<is_compound, double>(false)) );
VERIFY( (test_category<is_compound, long double>(false)) );
// Sanity check.
VERIFY( (test_category<is_compound, ClassType>(true)) );
}
int main()
{
test01();
return 0;
}
......@@ -2,7 +2,7 @@
// 2009-10-29 Paolo Carlini <paolo.carlini@oracle.com>
//
// Copyright (C) 2009 Free Software Foundation, Inc.
// Copyright (C) 2009, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
......@@ -58,6 +58,8 @@ void test01()
VERIFY( (test_relationship<is_convertible, void, volatile void>(true)) );
VERIFY( (test_relationship<is_convertible, double&, ExplicitClass>(true)) );
VERIFY( (test_relationship<is_convertible, int(int), int(&)(int)>(true)) );
// Negative tests.
VERIFY( (test_relationship<is_convertible, const int*, int*>(false)) );
VERIFY( (test_relationship<is_convertible, int*, float*>(false)) );
......@@ -93,8 +95,6 @@ void test01()
const volatile int&>(false)) );
VERIFY( (test_relationship<is_convertible, volatile int,
volatile int&>(false)) );
VERIFY( (test_relationship<is_convertible, int(int), int(&)(int)>(true)) );
VERIFY( (test_relationship<is_convertible, int&, ExplicitClass>(false)) );
VERIFY( (test_relationship<is_convertible, void*, ExplicitClass>(false)) );
}
......
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct is_default_constructible<test_type>;
}
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
//
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
// { dg-do compile }
void test01()
{
// Check for required typedefs
typedef std::is_default_constructible<int> test_type;
typedef test_type::value_type value_type;
typedef test_type::type type;
typedef test_type::type::value_type type_value_type;
typedef test_type::type::type type_type;
}
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <initializer_list>
#include <testsuite_tr1.h>
using namespace __gnu_test::construct_destruct;
static_assert(std::is_default_constructible<int>::value, "Error");
static_assert(std::is_default_constructible<int const>::value, "Error");
static_assert(std::is_default_constructible<int const volatile>::value,
"Error");
static_assert(std::is_default_constructible<int*>::value, "Error");
static_assert(std::is_default_constructible<void*>::value, "Error");
static_assert(std::is_default_constructible<void* const>::value, "Error");
static_assert(std::is_default_constructible<int B::*>::value, "Error");
static_assert(std::is_default_constructible<void(*)()>::value, "Error");
static_assert(std::is_default_constructible<std::nullptr_t>::value, "Error");
static_assert(std::is_default_constructible<std::nullptr_t const>::value,
"Error");
static_assert(std::is_default_constructible<Empty>::value, "Error");
static_assert(std::is_default_constructible<Empty const>::value, "Error");
static_assert(std::is_default_constructible<FromArgs<>>::value, "Error");
static_assert(std::is_default_constructible<FromArgs<> const>::value, "Error");
static_assert(std::is_default_constructible<nAny>::value, "Error");
static_assert(std::is_default_constructible<nAny const>::value, "Error");
static_assert(std::is_default_constructible<Ellipsis>::value, "Error");
static_assert(std::is_default_constructible<Ellipsis const>::value, "Error");
static_assert(std::is_default_constructible<U>::value, "Error");
static_assert(std::is_default_constructible<U const>::value, "Error");
static_assert(std::is_default_constructible<E>::value, "Error");
static_assert(std::is_default_constructible<E const>::value, "Error");
static_assert(std::is_default_constructible<SE>::value, "Error");
static_assert(std::is_default_constructible<SE const>::value, "Error");
static_assert(std::is_default_constructible<OpE>::value, "Error");
static_assert(std::is_default_constructible<OpE const>::value, "Error");
static_assert(std::is_default_constructible<OpSE>::value, "Error");
static_assert(std::is_default_constructible<OpSE const>::value, "Error");
static_assert(std::is_default_constructible<int[1]>::value, "Error");
static_assert(std::is_default_constructible<const int[1]>::value, "Error");
static_assert(std::is_default_constructible<int[1][2]>::value, "Error");
static_assert(std::is_default_constructible<const int[1][2]>::value, "Error");
static_assert(std::is_default_constructible<FromArgs<>[1]>::value, "Error");
static_assert(std::is_default_constructible<const FromArgs<>[1]>::value,
"Error");
static_assert(std::is_default_constructible<U[1]>::value, "Error");
static_assert(std::is_default_constructible<const U[1]>::value, "Error");
static_assert(std::is_default_constructible<Empty[1]>::value, "Error");
static_assert(std::is_default_constructible<const Empty[1]>::value, "Error");
static_assert(std::is_default_constructible<Ellipsis[1]>::value, "Error");
static_assert(std::is_default_constructible<const Ellipsis[1]>::value, "Error");
static_assert(std::is_default_constructible<std::nullptr_t[1]>::value, "Error");
static_assert(std::is_default_constructible<const std::nullptr_t[1]>::value,
"Error");
static_assert(std::is_default_constructible<nAny[1]>::value, "Error");
static_assert(std::is_default_constructible<const nAny[1]>::value, "Error");
static_assert(std::is_default_constructible<E[1]>::value, "Error");
static_assert(std::is_default_constructible<const E[1]>::value, "Error");
static_assert(std::is_default_constructible<SE[1]>::value, "Error");
static_assert(std::is_default_constructible<const SE[1]>::value, "Error");
static_assert(std::is_default_constructible<OpE[1]>::value, "Error");
static_assert(std::is_default_constructible<const OpE[1]>::value, "Error");
static_assert(std::is_default_constructible<OpSE[1]>::value, "Error");
static_assert(std::is_default_constructible<const OpSE[1]>::value, "Error");
static_assert(std::is_default_constructible<int*[1]>::value, "Error");
static_assert(std::is_default_constructible<int* const[1]>::value, "Error");
static_assert(std::is_default_constructible<int B::*[1]>::value, "Error");
static_assert(std::is_default_constructible<int B::* const[1]>::value, "Error");
static_assert(std::is_default_constructible<std::initializer_list<int>>::value,
"Error");
static_assert(std::is_default_constructible<const
std::initializer_list<int>>::value, "Error");
static_assert(std::is_default_constructible<
std::initializer_list<int>[1]>::value, "Error");
static_assert(std::is_default_constructible<const
std::initializer_list<int>[1]>::value, "Error");
static_assert(!std::is_default_constructible<void>::value, "Error");
static_assert(!std::is_default_constructible<const void>::value, "Error");
static_assert(!std::is_default_constructible<Abstract>::value, "Error");
static_assert(!std::is_default_constructible<const Abstract>::value, "Error");
static_assert(!std::is_default_constructible<Any>::value, "Error");
static_assert(!std::is_default_constructible<const Any>::value, "Error");
static_assert(!std::is_default_constructible<FromArgs<int>>::value, "Error");
static_assert(!std::is_default_constructible<const FromArgs<int>>::value,
"Error");
static_assert(!std::is_default_constructible<int&>::value, "Error");
static_assert(!std::is_default_constructible<int&&>::value, "Error");
static_assert(!std::is_default_constructible<void()>::value, "Error");
static_assert(!std::is_default_constructible<void() const volatile>::value,
"Error");
static_assert(!std::is_default_constructible<void(&)()>::value, "Error");
static_assert(!std::is_default_constructible<int(&)[1]>::value, "Error");
static_assert(!std::is_default_constructible<int(&)[]>::value, "Error");
static_assert(!std::is_default_constructible<int[]>::value, "Error");
static_assert(!std::is_default_constructible<const int[]>::value, "Error");
static_assert(!std::is_default_constructible<int[][1][2]>::value, "Error");
static_assert(!std::is_default_constructible<const int[][1][2]>::value,
"Error");
static_assert(!std::is_default_constructible<Any[1]>::value, "Error");
static_assert(!std::is_default_constructible<const Any[1]>::value, "Error");
static_assert(!std::is_default_constructible<FromArgs<int>[1]>::value, "Error");
static_assert(!std::is_default_constructible<const FromArgs<int>[1]>::value,
"Error");
static_assert(!std::is_default_constructible<
FromArgs<std::initializer_list<int>>>::value, "Error");
static_assert(!std::is_default_constructible<const
FromArgs<std::initializer_list<int>>>::value, "Error");
static_assert(!std::is_default_constructible<const
FromArgs<const std::initializer_list<int>>>::value, "Error");
static_assert(!std::is_default_constructible<DelDef>::value, "Error");
static_assert(!std::is_default_constructible<const DelDef>::value, "Error");
static_assert(!std::is_default_constructible<DelCopy>::value, "Error");
static_assert(!std::is_default_constructible<const DelCopy>::value, "Error");
static_assert(!std::is_default_constructible<DelDtor>::value, "Error");
static_assert(!std::is_default_constructible<const DelDtor>::value, "Error");
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct is_destructible<test_type>;
}
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
//
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
// { dg-do compile }
void test01()
{
// Check for required typedefs
typedef std::is_destructible<int> test_type;
typedef test_type::value_type value_type;
typedef test_type::type type;
typedef test_type::type::value_type type_value_type;
typedef test_type::type::type type_type;
}
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <initializer_list>
#include <testsuite_tr1.h>
using namespace __gnu_test::construct_destruct;
static_assert(std::is_destructible<int>::value, "Error");
static_assert(std::is_destructible<const int>::value, "Error");
static_assert(std::is_destructible<bool>::value, "Error");
static_assert(std::is_destructible<const bool>::value, "Error");
static_assert(std::is_destructible<int*>::value, "Error");
static_assert(std::is_destructible<void*>::value, "Error");
static_assert(std::is_destructible<int B::*>::value, "Error");
static_assert(std::is_destructible<const int D::*>::value, "Error");
static_assert(std::is_destructible<E>::value, "Error");
static_assert(std::is_destructible<const E>::value, "Error");
static_assert(std::is_destructible<SE>::value, "Error");
static_assert(std::is_destructible<const SE>::value, "Error");
static_assert(std::is_destructible<OpE>::value, "Error");
static_assert(std::is_destructible<const OpE>::value, "Error");
static_assert(std::is_destructible<OpSE>::value, "Error");
static_assert(std::is_destructible<const OpSE>::value, "Error");
static_assert(std::is_destructible<std::nullptr_t>::value, "Error");
static_assert(std::is_destructible<const std::nullptr_t>::value, "Error");
static_assert(std::is_destructible<B>::value, "Error");
static_assert(std::is_destructible<const B>::value, "Error");
static_assert(std::is_destructible<D>::value, "Error");
static_assert(std::is_destructible<const D>::value, "Error");
static_assert(std::is_destructible<Empty>::value, "Error");
static_assert(std::is_destructible<const Empty>::value, "Error");
static_assert(std::is_destructible<U>::value, "Error");
static_assert(std::is_destructible<const U>::value, "Error");
static_assert(std::is_destructible<Abstract>::value, "Error");
static_assert(std::is_destructible<const Abstract>::value, "Error");
static_assert(std::is_destructible<int[1]>::value, "Error");
static_assert(std::is_destructible<const int[1]>::value, "Error");
static_assert(std::is_destructible<int[1][2]>::value, "Error");
static_assert(std::is_destructible<const int[1][2]>::value, "Error");
static_assert(std::is_destructible<int&>::value, "Error");
static_assert(std::is_destructible<int&&>::value, "Error");
static_assert(std::is_destructible<void(&)()>::value, "Error");
static_assert(std::is_destructible<Ellipsis>::value, "Error");
static_assert(std::is_destructible<const Ellipsis>::value, "Error");
static_assert(std::is_destructible<Any>::value, "Error");
static_assert(std::is_destructible<const Any>::value, "Error");
static_assert(std::is_destructible<nAny>::value, "Error");
static_assert(std::is_destructible<const nAny>::value, "Error");
static_assert(std::is_destructible<DelDef>::value, "Error");
static_assert(std::is_destructible<const DelDef>::value, "Error");
static_assert(std::is_destructible<DelCopy>::value, "Error");
static_assert(std::is_destructible<const DelCopy>::value, "Error");
static_assert(std::is_destructible<DelEllipsis>::value, "Error");
static_assert(std::is_destructible<const DelEllipsis>::value, "Error");
static_assert(std::is_destructible<std::initializer_list<int>>::value,
"Error");
static_assert(std::is_destructible<const std::initializer_list<int>>::value,
"Error");
static_assert(std::is_destructible<void()>::value, "Error");
static_assert(std::is_destructible<void() const>::value, "Error");
static_assert(!std::is_destructible<void>::value, "Error");
static_assert(!std::is_destructible<const void>::value, "Error");
static_assert(!std::is_destructible<int[]>::value, "Error");
static_assert(!std::is_destructible<const int[]>::value, "Error");
static_assert(!std::is_destructible<DelDtor>::value, "Error");
static_assert(!std::is_destructible<const DelDtor>::value, "Error");
static_assert(!std::is_destructible<AbstractDelDtor>::value, "Error");
static_assert(!std::is_destructible<const AbstractDelDtor>::value, "Error");
static_assert(!std::is_destructible<int[][1]>::value, "Error");
static_assert(!std::is_destructible<const int[][1]>::value, "Error");
static_assert(!std::is_destructible<DelDtor[1]>::value, "Error");
static_assert(!std::is_destructible<const DelDtor[1]>::value, "Error");
static_assert(!std::is_destructible<DelDtor[]>::value, "Error");
static_assert(!std::is_destructible<const DelDtor[]>::value, "Error");
// Deleted members in unions with non-trivial members:
static_assert(!std::is_destructible<NontrivialUnion>::value, "Error");
// Unusual copy:
static_assert(std::is_destructible<UnusualCopy>::value, "Error");
// { dg-options "-std=gnu++0x" }
//
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_hooks.h>
#include <testsuite_tr1.h>
// libstdc++/24808
void test01()
{
bool test __attribute__((unused)) = true;
using std::is_function;
using namespace __gnu_test;
VERIFY( (test_category<is_function, IncompleteClass>(false)) );
}
int main()
{
test01();
return 0;
}
// { dg-options "-std=gnu++0x -pedantic-errors" }
// { dg-do compile }
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <functional>
struct S
{
void F() const {}
};
// libstdc++/35637
void test01()
{
std::function<void (S *)> a(&S::F);
}
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct is_function<test_type>;
}
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
//
// NB: This file is for testing tr1/type_traits with NO OTHER INCLUDES.
#include <type_traits>
void test01()
{
// Check for required typedefs
typedef std::is_function<int> test_type;
typedef test_type::value_type value_type;
typedef test_type::type type;
typedef test_type::type::value_type type_value_type;
typedef test_type::type::type type_type;
}
// { dg-options "-std=gnu++0x" }
//
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_hooks.h>
#include <testsuite_tr1.h>
void test01()
{
bool test __attribute__((unused)) = true;
using std::is_function;
using namespace __gnu_test;
// Positive tests.
VERIFY( (test_category<is_function, int (int)>(true)) );
VERIFY( (test_category<is_function, ClassType (ClassType)>(true)) );
VERIFY( (test_category<is_function, float (int, float, int[], int&)>(true)) );
VERIFY( (test_category<is_function, int (int, ...)>(true)) );
// Negative tests.
VERIFY( (test_category<is_function, int&>(false)) );
VERIFY( (test_category<is_function, void>(false)) );
VERIFY( (test_category<is_function, const void>(false)) );
VERIFY( (test_category<is_function, AbstractClass>(false)) );
VERIFY( (test_category<is_function, int(&)(int)>(false)) );
// Sanity check.
VERIFY( (test_category<is_function, ClassType>(false)) );
}
int main()
{
test01();
return 0;
}
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct is_fundamental<test_type>;
}
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
//
// NB: This file is for testing tr1/type_traits with NO OTHER INCLUDES.
#include <type_traits>
void test01()
{
// Check for required typedefs
typedef std::is_fundamental<int> test_type;
typedef test_type::value_type value_type;
typedef test_type::type type;
typedef test_type::type::value_type type_value_type;
typedef test_type::type::type type_type;
}
// { dg-options "-std=gnu++0x" }
//
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_hooks.h>
#include <testsuite_tr1.h>
void test01()
{
bool test __attribute__((unused)) = true;
using std::is_fundamental;
using namespace __gnu_test;
VERIFY( (test_category<is_fundamental, void>(true)) );
VERIFY( (test_category<is_fundamental, char>(true)) );
VERIFY( (test_category<is_fundamental, signed char>(true)) );
VERIFY( (test_category<is_fundamental, unsigned char>(true)) );
#ifdef _GLIBCXX_USE_WCHAR_T
VERIFY( (test_category<is_fundamental, wchar_t>(true)) );
#endif
VERIFY( (test_category<is_fundamental, short>(true)) );
VERIFY( (test_category<is_fundamental, unsigned short>(true)) );
VERIFY( (test_category<is_fundamental, int>(true)) );
VERIFY( (test_category<is_fundamental, unsigned int>(true)) );
VERIFY( (test_category<is_fundamental, long>(true)) );
VERIFY( (test_category<is_fundamental, unsigned long>(true)) );
VERIFY( (test_category<is_fundamental, long long>(true)) );
VERIFY( (test_category<is_fundamental, unsigned long long>(true)) );
VERIFY( (test_category<is_fundamental, float>(true)) );
VERIFY( (test_category<is_fundamental, double>(true)) );
VERIFY( (test_category<is_fundamental, long double>(true)) );
// Sanity check.
VERIFY( (test_category<is_fundamental, ClassType>(false)) );
}
int main()
{
test01();
return 0;
}
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct is_member_function_pointer<test_type>;
}
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
//
// NB: This file is for testing tr1/type_traits with NO OTHER INCLUDES.
#include <type_traits>
void test01()
{
// Check for required typedefs
typedef std::is_member_function_pointer<int> test_type;
typedef test_type::value_type value_type;
typedef test_type::type type;
typedef test_type::type::value_type type_value_type;
typedef test_type::type::type type_type;
}
// { dg-options "-std=gnu++0x" }
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_hooks.h>
#include <testsuite_tr1.h>
void test01()
{
bool test __attribute__((unused)) = true;
using std::is_member_function_pointer;
using namespace __gnu_test;
// Positive tests.
VERIFY( (test_category<is_member_function_pointer,
int (ClassType::*) (int)>(true)) );
VERIFY( (test_category<is_member_function_pointer,
int (ClassType::*) (int) const>(true)) );
VERIFY( (test_category<is_member_function_pointer,
int (ClassType::*) (float, ...)>(true)) );
VERIFY( (test_category<is_member_function_pointer,
ClassType (ClassType::*) (ClassType)>(true)) );
VERIFY( (test_category<is_member_function_pointer,
float (ClassType::*) (int, float, int[], int&)>(true)) );
// Negative tests.
VERIFY( (test_category<is_member_function_pointer,
int (ClassType::*)>(false)) );
VERIFY( (test_category<is_member_function_pointer,
const int (ClassType::*)>(false)) );
VERIFY( (test_category<is_member_function_pointer,
ClassType (ClassType::*)>(false)) );
// Sanity check.
VERIFY( (test_category<is_member_function_pointer, ClassType>(false)) );
}
int main()
{
test01();
return 0;
}
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct is_member_object_pointer<test_type>;
}
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
//
// NB: This file is for testing tr1/type_traits with NO OTHER INCLUDES.
#include <type_traits>
void test01()
{
// Check for required typedefs
typedef std::is_member_object_pointer<int> test_type;
typedef test_type::value_type value_type;
typedef test_type::type type;
typedef test_type::type::value_type type_value_type;
typedef test_type::type::type type_type;
}
// { dg-options "-std=gnu++0x" }
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_hooks.h>
#include <testsuite_tr1.h>
void test01()
{
bool test __attribute__((unused)) = true;
using std::is_member_object_pointer;
using namespace __gnu_test;
// Positive tests.
VERIFY( (test_category<is_member_object_pointer,
int (ClassType::*)>(true)) );
VERIFY( (test_category<is_member_object_pointer,
const int (ClassType::*)>(true)) );
VERIFY( (test_category<is_member_object_pointer,
ClassType (ClassType::*)>(true)) );
// Negative tests.
VERIFY( (test_category<is_member_object_pointer,
int (ClassType::*) (int)>(false)) );
VERIFY( (test_category<is_member_object_pointer,
int (ClassType::*) (int) const>(false)) );
VERIFY( (test_category<is_member_object_pointer,
int (ClassType::*) (float, ...)>(false)) );
VERIFY( (test_category<is_member_object_pointer,
ClassType (ClassType::*) (ClassType)>(false)) );
VERIFY( (test_category<is_member_object_pointer,
float (ClassType::*) (int, float, int[], int&)>(false)) );
// Sanity check.
VERIFY( (test_category<is_member_object_pointer, ClassType>(false)) );
}
int main()
{
test01();
return 0;
}
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct is_member_pointer<test_type>;
}
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
//
// NB: This file is for testing tr1/type_traits with NO OTHER INCLUDES.
#include <type_traits>
void test01()
{
// Check for required typedefs
typedef std::is_member_pointer<int> test_type;
typedef test_type::value_type value_type;
typedef test_type::type type;
typedef test_type::type::value_type type_value_type;
typedef test_type::type::type type_type;
}
// { dg-options "-std=gnu++0x" }
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_hooks.h>
#include <testsuite_tr1.h>
void test01()
{
bool test __attribute__((unused)) = true;
using std::is_member_pointer;
using namespace __gnu_test;
VERIFY( (test_category<is_member_pointer, int (ClassType::*)>(true)) );
VERIFY( (test_category<is_member_pointer, const int (ClassType::*)>(true)) );
VERIFY( (test_category<is_member_pointer, ClassType (ClassType::*)>(true)) );
VERIFY( (test_category<is_member_pointer,
int (ClassType::*) (int)>(true)) );
VERIFY( (test_category<is_member_pointer,
int (ClassType::*) (int) const>(true)) );
VERIFY( (test_category<is_member_pointer,
int (ClassType::*) (float, ...)>(true)) );
VERIFY( (test_category<is_member_pointer,
ClassType (ClassType::*) (ClassType)>(true)) );
VERIFY( (test_category<is_member_pointer,
float (ClassType::*) (int, float, int[], int&)>(true)) );
// Sanity check.
VERIFY( (test_category<is_member_pointer, ClassType>(false)) );
}
int main()
{
test01();
return 0;
}
// { dg-options "-std=gnu++0x" }
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_hooks.h>
#include <testsuite_tr1.h>
// libstdc++/24808
void test01()
{
bool test __attribute__((unused)) = true;
using std::is_object;
using namespace __gnu_test;
VERIFY( (test_category<is_object, IncompleteClass>(true)) );
}
int main()
{
test01();
return 0;
}
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
typedef short test_type;
template struct is_object<test_type>;
}
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
//
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
// { dg-do compile }
void test01()
{
// Check for required typedefs
typedef std::is_object<int> test_type;
typedef test_type::value_type value_type;
typedef test_type::type type;
typedef test_type::type::value_type type_value_type;
typedef test_type::type::type type_type;
}
// { dg-options "-std=gnu++0x" }
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_hooks.h>
#include <testsuite_tr1.h>
void test01()
{
bool test __attribute__((unused)) = true;
using std::is_object;
using namespace __gnu_test;
VERIFY( (test_category<is_object, int (int)>(false)) );
VERIFY( (test_category<is_object, ClassType (ClassType)>(false)) );
VERIFY( (test_category<is_object, float (int, float, int[], int&)>(false)) );
VERIFY( (test_category<is_object, int&>(false)) );
VERIFY( (test_category<is_object, ClassType&>(false)) );
VERIFY( (test_category<is_object, int(&)(int)>(false)) );
VERIFY( (test_category<is_object, void>(false)) );
VERIFY( (test_category<is_object, const void>(false)) );
// Sanity check.
VERIFY( (test_category<is_object, ClassType>(true)) );
}
int main()
{
test01();
return 0;
}
......@@ -3,7 +3,7 @@
// 2007-05-03 Benjamin Kosnik <bkoz@redhat.com>
//
// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
......@@ -48,5 +48,5 @@ void test01()
// { dg-error "instantiated from here" "" { target *-*-* } 40 }
// { dg-error "instantiated from here" "" { target *-*-* } 42 }
// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1097 }
// { dg-error "declaration of" "" { target *-*-* } 1061 }
// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1302 }
// { dg-error "declaration of" "" { target *-*-* } 1266 }
......@@ -48,5 +48,5 @@ void test01()
// { dg-error "instantiated from here" "" { target *-*-* } 40 }
// { dg-error "instantiated from here" "" { target *-*-* } 42 }
// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1020 }
// { dg-error "declaration of" "" { target *-*-* } 984 }
// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1226 }
// { dg-error "declaration of" "" { target *-*-* } 1190 }
......@@ -51,4 +51,4 @@ test04()
// { dg-error "instantiated from here" "" { target *-*-* } 46 }
// { dg-error "denominator cannot be zero" "" { target *-*-* } 155 }
// { dg-error "out of range" "" { target *-*-* } 156 }
// { dg-error "overflow in constant expression" "" { target *-*-* } 74 }
// { dg-error "overflow in constant expression" "" { target *-*-* } 99 }
// -*- C++ -*-
// Testing utilities for the tr1 testsuite.
//
// Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010
// Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
......@@ -283,6 +283,130 @@ namespace __gnu_test
check_ret_type(T)
{ return true; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
namespace construct_destruct
{
struct Empty {};
struct B { int i; B(){} };
struct D : B {};
enum E { ee1 };
enum E2 { ee2 };
enum class SE { e1 };
enum class SE2 { e2 };
enum OpE : int;
enum class OpSE : bool;
union U { int i; Empty b; };
struct Abstract
{
virtual ~Abstract() = 0;
};
struct AbstractDelDtor
{
~AbstractDelDtor() = delete;
virtual void foo() = 0;
};
struct Ukn;
template<class To>
struct ImplicitTo
{
operator To();
};
template<class To>
struct DelImplicitTo
{
operator To() = delete;
};
template<class To>
struct ExplicitTo
{
explicit operator To();
};
struct Ellipsis
{
Ellipsis(...){}
};
struct DelEllipsis
{
DelEllipsis(...) = delete;
};
struct Any
{
template<class T>
Any(T&&){}
};
struct nAny
{
template<class... T>
nAny(T&&...){}
};
struct DelnAny
{
template<class... T>
DelnAny(T&&...) = delete;
};
template<class... Args>
struct FromArgs
{
FromArgs(Args...);
};
struct DelDef
{
DelDef() = delete;
};
struct DelCopy
{
DelCopy(const DelCopy&) = delete;
};
struct DelDtor
{
DelDtor() = default;
DelDtor(const DelDtor&) = default;
DelDtor(DelDtor&&) = default;
DelDtor(int);
DelDtor(int, B, U);
~DelDtor() = delete;
};
struct Nontrivial
{
Nontrivial();
Nontrivial(const Nontrivial&);
Nontrivial& operator=(const Nontrivial&);
~Nontrivial();
};
union NontrivialUnion
{
int i;
Nontrivial n;
};
struct UnusualCopy
{
UnusualCopy(UnusualCopy&);
};
}
#endif
} // namespace __gnu_test
#endif // _GLIBCXX_TESTSUITE_TR1_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment