diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-04-19 00:10:53 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-04-19 00:10:53 +0000 |
commit | 505f943d08cafaa2ac478c98e813ba1a7749ff7f (patch) | |
tree | facddf3c84a29435c4341358f41cf948bd528d8e /libstdc++-v3/testsuite/20_util | |
parent | e51c3f95b340127d095d628a3f31f76679d7b6df (diff) | |
download | gcc-505f943d08cafaa2ac478c98e813ba1a7749ff7f.tar.gz |
2011-04-18 Paolo Carlini <paolo.carlini@oracle.com>
* include/std/type_traits (is_nothrow_default_constructible,
is_nothrow_copy_constructible, is_nothrow_move_constructible,
is_copy_constructible, is_move_constructible): Add.
(has_nothrow_default_constructor, has_nothrow_copy_constructor):
Remove.
(is_nothrow_constructible): Adjust.
* testsuite/util/testsuite_tr1.h (ThrowDefaultClass,
ThrowCopyConsClass, ThrowMoveConsClass, NoexceptDefaultClass,
ExceptDefaultClass, NoexceptCopyConsClass, ExceptCopyConsClass,
NoexceptMoveConsClass, ExceptMoveConsClass): Add in C++0x mode.
* testsuite/20_util/has_nothrow_default_constructor: Remove.
* testsuite/20_util/has_nothrow_copy_constructor: Likewise.
* testsuite/20_util/is_nothrow_move_constructible/value.cc: Likewise.
* testsuite/20_util/is_nothrow_move_constructible/requirements/
typedefs.cc: Likewise.
* testsuite/20_util/is_nothrow_move_constructible/requirements/
explicit_instantiation.cc: Likewise.
* testsuite/20_util/is_nothrow_copy_constructible/value.cc: Likewise.
* testsuite/20_util/is_nothrow_copy_constructible/requirements/
typedefs.cc: Likewise.
* testsuite/20_util/is_nothrow_copy_constructible/requirements/
explicit_instantiation.cc: Likewise.
* testsuite/20_util/is_nothrow_default_constructible/value.cc:
Likewise.
* testsuite/20_util/is_nothrow_default_constructible/requirements/
typedefs.cc: Likewise.
* testsuite/20_util/is_nothrow_default_constructible/requirements/
explicit_instantiation.cc: Likewise.
* testsuite/20_util/is_move_constructible/value.cc: Likewise.
* testsuite/20_util/is_move_constructible/requirements/typedefs.cc:
Likewise.
* testsuite/20_util/is_move_constructible/requirements/
explicit_instantiation.cc: Likewise.
* testsuite/20_util/is_copy_constructible/value.cc: Likewise.
* testsuite/20_util/is_copy_constructible/requirements/typedefs.cc:
Likewise.
* testsuite/20_util/is_copy_constructible/requirements/
explicit_instantiation.cc: Likewise.
* testsuite/20_util/is_default_constructible/value.cc: Add tests.
* testsuite/20_util/is_nothrow_constructible/value.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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@172684 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite/20_util')
22 files changed, 589 insertions, 141 deletions
diff --git a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc index aaf1fb029db..6aee07a3dee 100644 --- a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc +++ b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc @@ -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 *-*-* } 1523 } +// { dg-error "static assertion failed" "" { target *-*-* } 1610 } #include <utility> diff --git a/libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/value.cc b/libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/value.cc deleted file mode 100644 index 963c7bd57a5..00000000000 --- a/libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/value.cc +++ /dev/null @@ -1,56 +0,0 @@ -// { dg-options "-std=gnu++0x" } -// 2004-12-30 Paolo Carlini <pcarlini@suse.de> -// -// Copyright (C) 2004, 2005, 2007, 2009 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::has_nothrow_copy_constructor; - using namespace __gnu_test; - - // Positive tests. - VERIFY( (test_category<has_nothrow_copy_constructor, int>(true)) ); - VERIFY( (test_category<has_nothrow_copy_constructor, float>(true)) ); - VERIFY( (test_category<has_nothrow_copy_constructor, EnumType>(true)) ); - VERIFY( (test_category<has_nothrow_copy_constructor, int*>(true)) ); - VERIFY( (test_category<has_nothrow_copy_constructor, int(*)(int)>(true)) ); - VERIFY( (test_category<has_nothrow_copy_constructor, int (ClassType::*)>(true)) ); - VERIFY( (test_category<has_nothrow_copy_constructor, int (ClassType::*) (int)>(true)) ); - VERIFY( (test_category<has_nothrow_copy_constructor, int[2]>(true)) ); - VERIFY( (test_category<has_nothrow_copy_constructor, float[][3]>(true)) ); - VERIFY( (test_category<has_nothrow_copy_constructor, EnumType[2][3][4]>(true)) ); - VERIFY( (test_category<has_nothrow_copy_constructor, int*[3]>(true)) ); - VERIFY( (test_category<has_nothrow_copy_constructor, int(*[][2])(int)>(true)) ); - VERIFY( (test_category<has_nothrow_copy_constructor, int (ClassType::*[2][3])>(true)) ); - VERIFY( (test_category<has_nothrow_copy_constructor, - int (ClassType::*[][2][3]) (int)>(true)) ); - - // Negative tests. - VERIFY( (test_category<has_nothrow_copy_constructor, void>(false)) ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/value.cc b/libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/value.cc deleted file mode 100644 index 01548211c40..00000000000 --- a/libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/value.cc +++ /dev/null @@ -1,61 +0,0 @@ -// { dg-options "-std=gnu++0x" } -// 2004-12-29 Paolo Carlini <pcarlini@suse.de> -// -// Copyright (C) 2004, 2005, 2006, 2007, 2009 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/>. - -// 4.5.3 Type properties - -#include <type_traits> -#include <testsuite_hooks.h> -#include <testsuite_tr1.h> - -void test01() -{ - bool test __attribute__((unused)) = true; - using std::has_nothrow_default_constructor; - using namespace __gnu_test; - - // Positive tests. - VERIFY( (test_category<has_nothrow_default_constructor, int>(true)) ); - VERIFY( (test_category<has_nothrow_default_constructor, float>(true)) ); - VERIFY( (test_category<has_nothrow_default_constructor, EnumType>(true)) ); - VERIFY( (test_category<has_nothrow_default_constructor, int*>(true)) ); - VERIFY( (test_category<has_nothrow_default_constructor, int(*)(int)>(true)) ); - VERIFY( (test_category<has_nothrow_default_constructor, int (ClassType::*)>(true)) ); - VERIFY( (test_category<has_nothrow_default_constructor, - int (ClassType::*) (int)>(true)) ); - VERIFY( (test_category<has_nothrow_default_constructor, int[2]>(true)) ); - VERIFY( (test_category<has_nothrow_default_constructor, float[][3]>(true)) ); - VERIFY( (test_category<has_nothrow_default_constructor, EnumType[2][3][4]>(true)) ); - VERIFY( (test_category<has_nothrow_default_constructor, int*[3]>(true)) ); - VERIFY( (test_category<has_nothrow_default_constructor, int(*[][2])(int)>(true)) ); - VERIFY( (test_category<has_nothrow_default_constructor, - int (ClassType::*[2][3])>(true)) ); - VERIFY( (test_category<has_nothrow_default_constructor, - int (ClassType::*[][2][3]) (int)>(true)) ); - VERIFY( (test_category<has_nothrow_default_constructor, ClassType>(true)) ); - - // Negative tests. - VERIFY( (test_category<has_nothrow_default_constructor, void>(false)) ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/20_util/is_copy_constructible/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_copy_constructible/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..4ff9d10251d --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_copy_constructible/requirements/explicit_instantiation.cc @@ -0,0 +1,29 @@ +// { 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_copy_constructible<test_type>; +} diff --git a/libstdc++-v3/testsuite/20_util/is_copy_constructible/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_copy_constructible/requirements/typedefs.cc new file mode 100644 index 00000000000..840a9f156da --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_copy_constructible/requirements/typedefs.cc @@ -0,0 +1,34 @@ +// { 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_copy_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; +} diff --git a/libstdc++-v3/testsuite/20_util/is_copy_constructible/value.cc b/libstdc++-v3/testsuite/20_util/is_copy_constructible/value.cc new file mode 100644 index 00000000000..d1c2ea6425d --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_copy_constructible/value.cc @@ -0,0 +1,73 @@ +// { 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_copy_constructible; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_category<is_copy_constructible, int>(true)) ); + VERIFY( (test_category<is_copy_constructible, float>(true)) ); + VERIFY( (test_category<is_copy_constructible, EnumType>(true)) ); + VERIFY( (test_category<is_copy_constructible, int*>(true)) ); + VERIFY( (test_category<is_copy_constructible, int(*)(int)>(true)) ); + VERIFY( (test_category<is_copy_constructible, + int (ClassType::*)>(true)) ); + VERIFY( (test_category<is_copy_constructible, + int (ClassType::*) (int)>(true)) ); + + VERIFY( (test_property<is_copy_constructible, + NoexceptCopyConsClass>(true)) ); + VERIFY( (test_property<is_copy_constructible, + const NoexceptCopyConsClass>(true)) ); + VERIFY( (test_property<is_copy_constructible, + ThrowCopyConsClass>(true)) ); + VERIFY( (test_property<is_copy_constructible, + ExceptCopyConsClass>(true)) ); + + // Negative tests. + VERIFY( (test_category<is_copy_constructible, void>(false)) ); + VERIFY( (test_category<is_copy_constructible, int[2]>(false)) ); + VERIFY( (test_category<is_copy_constructible, int[]>(false)) ); + VERIFY( (test_category<is_copy_constructible, float[][3]>(false)) ); + VERIFY( (test_category<is_copy_constructible, + EnumType[2][3][4]>(false)) ); + VERIFY( (test_category<is_copy_constructible, int*[3]>(false)) ); + VERIFY( (test_category<is_copy_constructible, + int(*[][2])(int)>(false)) ); + VERIFY( (test_category<is_copy_constructible, + int (ClassType::*[2][3])>(false)) ); + VERIFY( (test_category<is_copy_constructible, + int (ClassType::*[][2][3]) (int)>(false)) ); + + VERIFY( (test_property<is_copy_constructible, + volatile NoexceptCopyConsClass>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/is_default_constructible/value.cc b/libstdc++-v3/testsuite/20_util/is_default_constructible/value.cc index bd18d50482d..6461cb7d5fe 100644 --- a/libstdc++-v3/testsuite/20_util/is_default_constructible/value.cc +++ b/libstdc++-v3/testsuite/20_util/is_default_constructible/value.cc @@ -93,6 +93,13 @@ static_assert(std::is_default_constructible< static_assert(std::is_default_constructible<const std::initializer_list<int>[1]>::value, "Error"); +static_assert(std::is_default_constructible + <__gnu_test::NoexceptDefaultClass>::value, "Error"); +static_assert(std::is_default_constructible + <__gnu_test::ThrowDefaultClass>::value, "Error"); +static_assert(std::is_default_constructible + <__gnu_test::ExceptDefaultClass>::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"); diff --git a/libstdc++-v3/testsuite/20_util/is_move_constructible/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_move_constructible/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..2d67b20767d --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_move_constructible/requirements/explicit_instantiation.cc @@ -0,0 +1,29 @@ +// { 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_move_constructible<test_type>; +} diff --git a/libstdc++-v3/testsuite/20_util/is_move_constructible/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_move_constructible/requirements/typedefs.cc new file mode 100644 index 00000000000..76208d8ba10 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_move_constructible/requirements/typedefs.cc @@ -0,0 +1,34 @@ +// { 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_move_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; +} diff --git a/libstdc++-v3/testsuite/20_util/is_move_constructible/value.cc b/libstdc++-v3/testsuite/20_util/is_move_constructible/value.cc new file mode 100644 index 00000000000..623359a461e --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_move_constructible/value.cc @@ -0,0 +1,73 @@ +// { 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_move_constructible; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_category<is_move_constructible, int>(true)) ); + VERIFY( (test_category<is_move_constructible, float>(true)) ); + VERIFY( (test_category<is_move_constructible, EnumType>(true)) ); + VERIFY( (test_category<is_move_constructible, int*>(true)) ); + VERIFY( (test_category<is_move_constructible, int(*)(int)>(true)) ); + VERIFY( (test_category<is_move_constructible, + int (ClassType::*)>(true)) ); + VERIFY( (test_category<is_move_constructible, + int (ClassType::*) (int)>(true)) ); + + VERIFY( (test_property<is_move_constructible, + NoexceptMoveConsClass>(true)) ); + VERIFY( (test_property<is_move_constructible, + ThrowMoveConsClass>(true)) ); + VERIFY( (test_property<is_move_constructible, + ExceptMoveConsClass>(true)) ); + + // Negative tests. + VERIFY( (test_category<is_move_constructible, void>(false)) ); + VERIFY( (test_category<is_move_constructible, int[2]>(false)) ); + VERIFY( (test_category<is_move_constructible, int[]>(false)) ); + VERIFY( (test_category<is_move_constructible, float[][3]>(false)) ); + VERIFY( (test_category<is_move_constructible, + EnumType[2][3][4]>(false)) ); + VERIFY( (test_category<is_move_constructible, int*[3]>(false)) ); + VERIFY( (test_category<is_move_constructible, + int(*[][2])(int)>(false)) ); + VERIFY( (test_category<is_move_constructible, + int (ClassType::*[2][3])>(false)) ); + VERIFY( (test_category<is_move_constructible, + int (ClassType::*[][2][3]) (int)>(false)) ); + + VERIFY( (test_property<is_move_constructible, + const NoexceptMoveConsClass>(false)) ); + VERIFY( (test_property<is_move_constructible, + volatile NoexceptMoveConsClass>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_constructible/value.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_constructible/value.cc index b3246fad119..a77fa6c8b99 100644 --- a/libstdc++-v3/testsuite/20_util/is_nothrow_constructible/value.cc +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_constructible/value.cc @@ -2,7 +2,7 @@ // 2010-06-09 Paolo Carlini <paolo.carlini@oracle.com> -// Copyright (C) 2010 Free Software Foundation, Inc. +// Copyright (C) 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 @@ -43,6 +43,8 @@ void test01() VERIFY( (test_property<is_nothrow_constructible, NothrowExplicitClass, double&, int&, double&>(true)) ); + VERIFY( (test_property<is_nothrow_constructible, int[1]>(true)) ); + // Negative tests. VERIFY( (test_property<is_nothrow_constructible, NoexceptExplicitClass, void*>(false)) ); @@ -69,6 +71,8 @@ void test01() int&>(false)) ); VERIFY( (test_property<is_nothrow_constructible, ThrowExplicitClass, double&, int&, double&>(false)) ); + + VERIFY( (test_property<is_nothrow_constructible, int[]>(false)) ); } int main() diff --git a/libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_copy_constructible/requirements/explicit_instantiation.cc index 7c844515090..39ab86b6641 100644 --- a/libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/requirements/explicit_instantiation.cc +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_copy_constructible/requirements/explicit_instantiation.cc @@ -2,7 +2,7 @@ // { dg-do compile } // 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> -// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// Copyright (C) 2007, 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 @@ -19,7 +19,6 @@ // 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> @@ -27,5 +26,5 @@ namespace std { typedef short test_type; - template struct has_nothrow_copy_constructor<test_type>; + template struct is_nothrow_copy_constructible<test_type>; } diff --git a/libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_copy_constructible/requirements/typedefs.cc index 5c40837aa62..320010b1c48 100644 --- a/libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/requirements/typedefs.cc +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_copy_constructible/requirements/typedefs.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++0x" } // 2004-12-30 Paolo Carlini <pcarlini@suse.de> // -// Copyright (C) 2004, 2007, 2009 Free Software Foundation, Inc. +// Copyright (C) 2004, 2007, 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 @@ -28,9 +28,9 @@ void test01() { // Check for required typedefs - typedef std::has_nothrow_copy_constructor<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; + typedef std::is_nothrow_copy_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; } diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_copy_constructible/value.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_copy_constructible/value.cc new file mode 100644 index 00000000000..2c279967cc1 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_copy_constructible/value.cc @@ -0,0 +1,74 @@ +// { dg-options "-std=gnu++0x" } +// 2004-12-30 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2005, 2007, 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 +// 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_nothrow_copy_constructible; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_category<is_nothrow_copy_constructible, int>(true)) ); + VERIFY( (test_category<is_nothrow_copy_constructible, float>(true)) ); + VERIFY( (test_category<is_nothrow_copy_constructible, EnumType>(true)) ); + VERIFY( (test_category<is_nothrow_copy_constructible, int*>(true)) ); + VERIFY( (test_category<is_nothrow_copy_constructible, int(*)(int)>(true)) ); + VERIFY( (test_category<is_nothrow_copy_constructible, + int (ClassType::*)>(true)) ); + VERIFY( (test_category<is_nothrow_copy_constructible, + int (ClassType::*) (int)>(true)) ); + + VERIFY( (test_property<is_nothrow_copy_constructible, + NoexceptCopyConsClass>(true)) ); + VERIFY( (test_property<is_nothrow_copy_constructible, + const NoexceptCopyConsClass>(true)) ); + + // Negative tests. + VERIFY( (test_category<is_nothrow_copy_constructible, void>(false)) ); + VERIFY( (test_category<is_nothrow_copy_constructible, int[2]>(false)) ); + VERIFY( (test_category<is_nothrow_copy_constructible, int[]>(false)) ); + VERIFY( (test_category<is_nothrow_copy_constructible, float[][3]>(false)) ); + VERIFY( (test_category<is_nothrow_copy_constructible, + EnumType[2][3][4]>(false)) ); + VERIFY( (test_category<is_nothrow_copy_constructible, int*[3]>(false)) ); + VERIFY( (test_category<is_nothrow_copy_constructible, + int(*[][2])(int)>(false)) ); + VERIFY( (test_category<is_nothrow_copy_constructible, + int (ClassType::*[2][3])>(false)) ); + VERIFY( (test_category<is_nothrow_copy_constructible, + int (ClassType::*[][2][3]) (int)>(false)) ); + + VERIFY( (test_property<is_nothrow_copy_constructible, + volatile NoexceptCopyConsClass>(false)) ); + VERIFY( (test_property<is_nothrow_copy_constructible, + ThrowCopyConsClass>(false)) ); + VERIFY( (test_property<is_nothrow_copy_constructible, + ExceptCopyConsClass>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_default_constructible/requirements/explicit_instantiation.cc index dec9b965e81..2c7e2df5e5e 100644 --- a/libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/requirements/explicit_instantiation.cc +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_default_constructible/requirements/explicit_instantiation.cc @@ -2,7 +2,7 @@ // { dg-do compile } // 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> -// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// Copyright (C) 2007, 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 @@ -19,7 +19,6 @@ // 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> @@ -27,5 +26,5 @@ namespace std { typedef short test_type; - template struct has_nothrow_default_constructor<test_type>; + template struct is_nothrow_default_constructible<test_type>; } diff --git a/libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_default_constructible/requirements/typedefs.cc index 709fff331f5..0c0fd6426d0 100644 --- a/libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/requirements/typedefs.cc +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_default_constructible/requirements/typedefs.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++0x" } // 2004-12-29 Paolo Carlini <pcarlini@suse.de> // -// Copyright (C) 2004, 2007, 2009 Free Software Foundation, Inc. +// Copyright (C) 2004, 2007, 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 @@ -28,9 +28,9 @@ void test01() { // Check for required typedefs - typedef std::has_nothrow_default_constructor<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; + typedef std::is_nothrow_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; } diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_default_constructible/value.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_default_constructible/value.cc new file mode 100644 index 00000000000..d806cf1cf03 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_default_constructible/value.cc @@ -0,0 +1,74 @@ +// { dg-options "-std=gnu++0x" } +// 2004-12-29 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2005, 2006, 2007, 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 +// 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_nothrow_default_constructible; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_category<is_nothrow_default_constructible, int>(true)) ); + VERIFY( (test_category<is_nothrow_default_constructible, float>(true)) ); + VERIFY( (test_category<is_nothrow_default_constructible, EnumType>(true)) ); + VERIFY( (test_category<is_nothrow_default_constructible, int*>(true)) ); + VERIFY( (test_category<is_nothrow_default_constructible, + int(*)(int)>(true)) ); + VERIFY( (test_category<is_nothrow_default_constructible, + int (ClassType::*)>(true)) ); + VERIFY( (test_category<is_nothrow_default_constructible, + int (ClassType::*) (int)>(true)) ); + VERIFY( (test_category<is_nothrow_default_constructible, int[2]>(true)) ); + VERIFY( (test_category<is_nothrow_default_constructible, + EnumType[2][3][4]>(true)) ); + VERIFY( (test_category<is_nothrow_default_constructible, int*[3]>(true)) ); + VERIFY( (test_category<is_nothrow_default_constructible, + int (ClassType::*[2][3])>(true)) ); + VERIFY( (test_category<is_nothrow_default_constructible, ClassType>(true)) ); + + VERIFY( (test_category<is_nothrow_default_constructible, + NoexceptDefaultClass>(true)) ); + + // Negative tests. + VERIFY( (test_category<is_nothrow_default_constructible, void>(false)) ); + VERIFY( (test_category<is_nothrow_default_constructible, int[]>(false)) ); + VERIFY( (test_category<is_nothrow_default_constructible, + float[][3]>(false)) ); + VERIFY( (test_category<is_nothrow_default_constructible, + int(*[][2])(int)>(false)) ); + VERIFY( (test_category<is_nothrow_default_constructible, + int (ClassType::*[][2][3]) (int)>(false)) ); + + VERIFY( (test_category<is_nothrow_default_constructible, + ThrowDefaultClass>(false)) ); + VERIFY( (test_category<is_nothrow_default_constructible, + ExceptDefaultClass>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_move_constructible/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_move_constructible/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..bca081b2302 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_move_constructible/requirements/explicit_instantiation.cc @@ -0,0 +1,29 @@ +// { 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_nothrow_move_constructible<test_type>; +} diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_move_constructible/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_move_constructible/requirements/typedefs.cc new file mode 100644 index 00000000000..13a0e3ee8d4 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_move_constructible/requirements/typedefs.cc @@ -0,0 +1,34 @@ +// { 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_nothrow_move_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; +} diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_move_constructible/value.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_move_constructible/value.cc new file mode 100644 index 00000000000..b154f787a3b --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_move_constructible/value.cc @@ -0,0 +1,73 @@ +// { 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_nothrow_move_constructible; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_category<is_nothrow_move_constructible, int>(true)) ); + VERIFY( (test_category<is_nothrow_move_constructible, float>(true)) ); + VERIFY( (test_category<is_nothrow_move_constructible, EnumType>(true)) ); + VERIFY( (test_category<is_nothrow_move_constructible, int*>(true)) ); + VERIFY( (test_category<is_nothrow_move_constructible, int(*)(int)>(true)) ); + VERIFY( (test_category<is_nothrow_move_constructible, + int (ClassType::*)>(true)) ); + VERIFY( (test_category<is_nothrow_move_constructible, + int (ClassType::*) (int)>(true)) ); + + VERIFY( (test_property<is_nothrow_move_constructible, + NoexceptMoveConsClass>(true)) ); + + // Negative tests. + VERIFY( (test_category<is_nothrow_move_constructible, void>(false)) ); + VERIFY( (test_category<is_nothrow_move_constructible, int[2]>(false)) ); + VERIFY( (test_category<is_nothrow_move_constructible, int[]>(false)) ); + VERIFY( (test_category<is_nothrow_move_constructible, float[][3]>(false)) ); + VERIFY( (test_category<is_nothrow_move_constructible, + EnumType[2][3][4]>(false)) ); + VERIFY( (test_category<is_nothrow_move_constructible, int*[3]>(false)) ); + VERIFY( (test_category<is_nothrow_move_constructible, + int(*[][2])(int)>(false)) ); + VERIFY( (test_category<is_nothrow_move_constructible, + int (ClassType::*[2][3])>(false)) ); + VERIFY( (test_category<is_nothrow_move_constructible, + int (ClassType::*[][2][3]) (int)>(false)) ); + + VERIFY( (test_property<is_nothrow_move_constructible, + const NoexceptMoveConsClass>(false)) ); + VERIFY( (test_property<is_nothrow_move_constructible, + volatile NoexceptMoveConsClass>(false)) ); + VERIFY( (test_property<is_nothrow_move_constructible, + ThrowMoveConsClass>(false)) ); + VERIFY( (test_property<is_nothrow_move_constructible, + ExceptMoveConsClass>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc index 4a568e363e8..871bbe571e7 100644 --- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc +++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc @@ -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 *-*-* } 1302 } -// { dg-error "declaration of" "" { target *-*-* } 1266 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1389 } +// { dg-error "declaration of" "" { target *-*-* } 1353 } diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc index 955c1ce00f2..edcce7cf0f5 100644 --- a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc +++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc @@ -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 *-*-* } 1226 } -// { dg-error "declaration of" "" { target *-*-* } 1190 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1313 } +// { dg-error "declaration of" "" { target *-*-* } 1277 } |