From patchwork Tue Apr 19 00:20:36 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 91898 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id C6731B6F71 for ; Tue, 19 Apr 2011 10:21:30 +1000 (EST) Received: (qmail 21442 invoked by alias); 19 Apr 2011 00:21:28 -0000 Received: (qmail 21396 invoked by uid 22791); 19 Apr 2011 00:21:16 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from smtp208.alice.it (HELO smtp208.alice.it) (82.57.200.104) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 19 Apr 2011 00:20:55 +0000 Received: from [192.168.1.4] (79.51.11.17) by smtp208.alice.it (8.5.124.08) id 4C1A27161772DF45; Tue, 19 Apr 2011 02:20:48 +0200 Message-ID: <4DACD554.10403@oracle.com> Date: Tue, 19 Apr 2011 02:20:36 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110221 SUSE/3.1.8 Thunderbird/3.1.8 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: libstdc++ Subject: [v3] Implement is_nothrow_*_constructible, is_copy_constructible, is_move_constructible X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, the below implements a few traits - among which those necessary for move_if_noexcept, obviously forthcoming, at this point - per the FDIS and fixes is_nothrow_constructible vs the issue noticed at the end of the audit trail of 48531: Daniel clarified that, per the FDIS anyway (seems a core defect, actually) we need to special case is_nothrow_default_constructible and implement it separately from the general n-ary is_nothrow_constructible, similarly to is_default_constructible vs is_constructible. Tested x86_64-linux, committed. Paolo. ////////////////////// 2011-04-18 Paolo Carlini * 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. Index: include/std/type_traits =================================================================== --- include/std/type_traits (revision 172657) +++ include/std/type_traits (working copy) @@ -854,29 +854,134 @@ _Args...>::value)> { }; + template::value> + struct __is_copy_constructible_impl; - template - struct __is_nt_constructible_helper - { static const bool __value = false; }; + template + struct __is_copy_constructible_impl<_Tp, true> + : public false_type { }; + template + struct __is_copy_constructible_impl<_Tp, false> + : public is_constructible<_Tp, const _Tp&> + { }; + + /// is_copy_constructible + template + struct is_copy_constructible + : public __is_copy_constructible_impl<_Tp> + { }; + + template::value> + struct __is_move_constructible_impl; + + template + struct __is_move_constructible_impl<_Tp, true> + : public false_type { }; + + template + struct __is_move_constructible_impl<_Tp, false> + : public is_constructible<_Tp, _Tp&&> + { }; + + /// is_move_constructible + template + struct is_move_constructible + : public __is_move_constructible_impl<_Tp> + { }; + + template + struct __is_nt_default_constructible_atom + : public integral_constant + { }; + + template::value> + struct __is_nt_default_constructible_impl; + + template + struct __is_nt_default_constructible_impl<_Tp, true> + : public __and_<__is_array_known_bounds<_Tp>, + __is_nt_default_constructible_atom::type>>::type + { }; + + template + struct __is_nt_default_constructible_impl<_Tp, false> + : public __is_nt_default_constructible_atom<_Tp> + { }; + + /// is_nothrow_default_constructible + template + struct is_nothrow_default_constructible + : public __and_, + __is_nt_default_constructible_impl<_Tp>>::type + { }; + template - struct __is_nt_constructible_helper - { static const bool __value = noexcept(_Tp(declval<_Args>()...)); }; + struct __is_nt_constructible_impl + : public integral_constant()...))> + { }; template - struct __is_nt_constructible_helper - { - static const bool __value = noexcept(static_cast<_Tp>(declval<_Arg>())); - }; + struct __is_nt_constructible_impl<_Tp, _Arg> + : public integral_constant(declval<_Arg>()))> + { }; + template + struct __is_nt_constructible_impl<_Tp> + : public is_nothrow_default_constructible<_Tp> + { }; + /// is_nothrow_constructible template struct is_nothrow_constructible - : public integral_constant::value, - _Tp, _Args...>::__value> + : public __and_, + __is_nt_constructible_impl<_Tp, _Args...>>::type { }; + template::value> + struct __is_nothrow_copy_constructible_impl; + + template + struct __is_nothrow_copy_constructible_impl<_Tp, true> + : public false_type { }; + + template + struct __is_nothrow_copy_constructible_impl<_Tp, false> + : public is_nothrow_constructible<_Tp, const _Tp&> + { }; + + /// is_nothrow_copy_constructible + template + struct is_nothrow_copy_constructible + : public __is_nothrow_copy_constructible_impl<_Tp> + { }; + + template::value> + struct __is_nothrow_move_constructible_impl; + + template + struct __is_nothrow_move_constructible_impl<_Tp, true> + : public false_type { }; + + template + struct __is_nothrow_move_constructible_impl<_Tp, false> + : public is_nothrow_constructible<_Tp, _Tp&&> + { }; + + /// is_nothrow_move_constructible + template + struct is_nothrow_move_constructible + : public __is_nothrow_move_constructible_impl<_Tp> + { }; + + /// has_nothrow_copy_assign + template + struct has_nothrow_copy_assign + : public integral_constant + { }; + /// has_trivial_default_constructor template struct has_trivial_default_constructor @@ -901,24 +1006,6 @@ : public integral_constant { }; - /// has_nothrow_default_constructor - template - struct has_nothrow_default_constructor - : public integral_constant - { }; - - /// has_nothrow_copy_constructor - template - struct has_nothrow_copy_constructor - : public integral_constant - { }; - - /// has_nothrow_copy_assign - template - struct has_nothrow_copy_assign - : public integral_constant - { }; - /// has_virtual_destructor template struct has_virtual_destructor Index: testsuite/util/testsuite_tr1.h =================================================================== --- testsuite/util/testsuite_tr1.h (revision 172657) +++ testsuite/util/testsuite_tr1.h (working copy) @@ -145,7 +145,22 @@ ThrowExplicitClass(double&, int&, double&) throw(int); }; + struct ThrowDefaultClass + { + ThrowDefaultClass() throw(int); + }; + + struct ThrowCopyConsClass + { + ThrowCopyConsClass(const ThrowCopyConsClass&) throw(int); + }; + #ifdef __GXX_EXPERIMENTAL_CXX0X__ + struct ThrowMoveConsClass + { + ThrowMoveConsClass(ThrowMoveConsClass&&) throw(int); + }; + struct NoexceptExplicitClass { NoexceptExplicitClass(double&) noexcept(true); @@ -159,6 +174,36 @@ explicit ExceptExplicitClass(int&) noexcept(false); ExceptExplicitClass(double&, int&, double&) noexcept(false); }; + + struct NoexceptDefaultClass + { + NoexceptDefaultClass() noexcept(true); + }; + + struct ExceptDefaultClass + { + ExceptDefaultClass() noexcept(false); + }; + + struct NoexceptCopyConsClass + { + NoexceptCopyConsClass(const NoexceptCopyConsClass&) noexcept(true); + }; + + struct ExceptCopyConsClass + { + ExceptCopyConsClass(const ExceptCopyConsClass&) noexcept(false); + }; + + struct NoexceptMoveConsClass + { + NoexceptMoveConsClass(NoexceptMoveConsClass&&) noexcept(true); + }; + + struct ExceptMoveConsClass + { + ExceptMoveConsClass(ExceptMoveConsClass&&) noexcept(false); + }; #endif struct NType // neither trivial nor standard-layout Index: testsuite/20_util/has_nothrow_default_constructor/value.cc =================================================================== --- testsuite/20_util/has_nothrow_default_constructor/value.cc (revision 172657) +++ testsuite/20_util/has_nothrow_default_constructor/value.cc (working copy) @@ -1,61 +0,0 @@ -// { dg-options "-std=gnu++0x" } -// 2004-12-29 Paolo Carlini -// -// 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 -// . - -// 4.5.3 Type properties - -#include -#include -#include - -void test01() -{ - bool test __attribute__((unused)) = true; - using std::has_nothrow_default_constructor; - using namespace __gnu_test; - - // Positive tests. - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - - // Negative tests. - VERIFY( (test_category(false)) ); -} - -int main() -{ - test01(); - return 0; -} Index: testsuite/20_util/has_nothrow_default_constructor/requirements/typedefs.cc =================================================================== --- testsuite/20_util/has_nothrow_default_constructor/requirements/typedefs.cc (revision 172657) +++ testsuite/20_util/has_nothrow_default_constructor/requirements/typedefs.cc (working copy) @@ -1,36 +0,0 @@ -// { dg-options "-std=gnu++0x" } -// 2004-12-29 Paolo Carlini -// -// Copyright (C) 2004, 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 -// . - -// -// NB: This file is for testing type_traits with NO OTHER INCLUDES. - -#include - -// { dg-do compile } - -void test01() -{ - // Check for required typedefs - typedef std::has_nothrow_default_constructor 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; -} Index: testsuite/20_util/has_nothrow_default_constructor/requirements/explicit_instantiation.cc =================================================================== --- testsuite/20_util/has_nothrow_default_constructor/requirements/explicit_instantiation.cc (revision 172657) +++ testsuite/20_util/has_nothrow_default_constructor/requirements/explicit_instantiation.cc (working copy) @@ -1,31 +0,0 @@ -// { dg-options "-std=gnu++0x" } -// { dg-do compile } -// 2007-04-30 Benjamin Kosnik - -// Copyright (C) 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 -// . - - -// NB: This file is for testing type_traits with NO OTHER INCLUDES. - -#include - -namespace std -{ - typedef short test_type; - template struct has_nothrow_default_constructor; -} Index: testsuite/20_util/make_signed/requirements/typedefs_neg.cc =================================================================== --- testsuite/20_util/make_signed/requirements/typedefs_neg.cc (revision 172657) +++ testsuite/20_util/make_signed/requirements/typedefs_neg.cc (working copy) @@ -48,5 +48,5 @@ // { 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 } Index: testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc =================================================================== --- testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc (revision 172657) +++ testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc (working copy) @@ -48,5 +48,5 @@ // { 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 } Index: testsuite/20_util/declval/requirements/1_neg.cc =================================================================== --- testsuite/20_util/declval/requirements/1_neg.cc (revision 172657) +++ testsuite/20_util/declval/requirements/1_neg.cc (working copy) @@ -19,7 +19,7 @@ // with this library; see the file COPYING3. If not see // . -// { dg-error "static assertion failed" "" { target *-*-* } 1523 } +// { dg-error "static assertion failed" "" { target *-*-* } 1610 } #include Index: testsuite/20_util/is_default_constructible/value.cc =================================================================== --- testsuite/20_util/is_default_constructible/value.cc (revision 172657) +++ testsuite/20_util/is_default_constructible/value.cc (working copy) @@ -93,6 +93,13 @@ static_assert(std::is_default_constructible[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::value, "Error"); static_assert(!std::is_default_constructible::value, "Error"); static_assert(!std::is_default_constructible::value, "Error"); Index: testsuite/20_util/is_nothrow_move_constructible/value.cc =================================================================== --- testsuite/20_util/is_nothrow_move_constructible/value.cc (revision 0) +++ testsuite/20_util/is_nothrow_move_constructible/value.cc (revision 0) @@ -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 +// . + +#include +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::is_nothrow_move_constructible; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + + VERIFY( (test_property(true)) ); + + // Negative tests. + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + + VERIFY( (test_property(false)) ); + VERIFY( (test_property(false)) ); + VERIFY( (test_property(false)) ); + VERIFY( (test_property(false)) ); +} + +int main() +{ + test01(); + return 0; +} Index: testsuite/20_util/is_nothrow_move_constructible/requirements/typedefs.cc =================================================================== --- testsuite/20_util/is_nothrow_move_constructible/requirements/typedefs.cc (revision 0) +++ testsuite/20_util/is_nothrow_move_constructible/requirements/typedefs.cc (revision 0) @@ -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 +// . + +// +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include + +void test01() +{ + // Check for required typedefs + typedef std::is_nothrow_move_constructible 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; +} Index: testsuite/20_util/is_nothrow_move_constructible/requirements/explicit_instantiation.cc =================================================================== --- testsuite/20_util/is_nothrow_move_constructible/requirements/explicit_instantiation.cc (revision 0) +++ testsuite/20_util/is_nothrow_move_constructible/requirements/explicit_instantiation.cc (revision 0) @@ -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 +// . + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include + +namespace std +{ + typedef short test_type; + template struct is_nothrow_move_constructible; +} Index: testsuite/20_util/is_nothrow_copy_constructible/value.cc =================================================================== --- testsuite/20_util/is_nothrow_copy_constructible/value.cc (revision 172657) +++ testsuite/20_util/is_nothrow_copy_constructible/value.cc (working copy) @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++0x" } // 2004-12-30 Paolo Carlini // -// Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. +// 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 @@ -25,28 +25,46 @@ void test01() { bool test __attribute__((unused)) = true; - using std::has_nothrow_copy_constructor; + using std::is_nothrow_copy_constructible; using namespace __gnu_test; // Positive tests. - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_property(true)) ); + VERIFY( (test_property(true)) ); + // Negative tests. - VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + + VERIFY( (test_property(false)) ); + VERIFY( (test_property(false)) ); + VERIFY( (test_property(false)) ); } int main() Index: testsuite/20_util/is_nothrow_copy_constructible/requirements/typedefs.cc =================================================================== --- testsuite/20_util/is_nothrow_copy_constructible/requirements/typedefs.cc (revision 172657) +++ testsuite/20_util/is_nothrow_copy_constructible/requirements/typedefs.cc (working copy) @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++0x" } // 2004-12-30 Paolo Carlini // -// 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 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 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; } Index: testsuite/20_util/is_nothrow_copy_constructible/requirements/explicit_instantiation.cc =================================================================== --- testsuite/20_util/is_nothrow_copy_constructible/requirements/explicit_instantiation.cc (revision 172657) +++ testsuite/20_util/is_nothrow_copy_constructible/requirements/explicit_instantiation.cc (working copy) @@ -2,7 +2,7 @@ // { dg-do compile } // 2007-04-30 Benjamin Kosnik -// 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 // . - // NB: This file is for testing type_traits with NO OTHER INCLUDES. #include @@ -27,5 +26,5 @@ namespace std { typedef short test_type; - template struct has_nothrow_copy_constructor; + template struct is_nothrow_copy_constructible; } Index: testsuite/20_util/is_nothrow_constructible/value.cc =================================================================== --- testsuite/20_util/is_nothrow_constructible/value.cc (revision 172657) +++ testsuite/20_util/is_nothrow_constructible/value.cc (working copy) @@ -2,7 +2,7 @@ // 2010-06-09 Paolo Carlini -// 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 @@ VERIFY( (test_property(true)) ); + VERIFY( (test_property(true)) ); + // Negative tests. VERIFY( (test_property(false)) ); @@ -69,6 +71,8 @@ int&>(false)) ); VERIFY( (test_property(false)) ); + + VERIFY( (test_property(false)) ); } int main() Index: testsuite/20_util/has_nothrow_copy_constructor/value.cc =================================================================== --- testsuite/20_util/has_nothrow_copy_constructor/value.cc (revision 172657) +++ testsuite/20_util/has_nothrow_copy_constructor/value.cc (working copy) @@ -1,56 +0,0 @@ -// { dg-options "-std=gnu++0x" } -// 2004-12-30 Paolo Carlini -// -// 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 -// . - -#include -#include -#include - -void test01() -{ - bool test __attribute__((unused)) = true; - using std::has_nothrow_copy_constructor; - using namespace __gnu_test; - - // Positive tests. - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - - // Negative tests. - VERIFY( (test_category(false)) ); -} - -int main() -{ - test01(); - return 0; -} Index: testsuite/20_util/has_nothrow_copy_constructor/requirements/typedefs.cc =================================================================== --- testsuite/20_util/has_nothrow_copy_constructor/requirements/typedefs.cc (revision 172657) +++ testsuite/20_util/has_nothrow_copy_constructor/requirements/typedefs.cc (working copy) @@ -1,36 +0,0 @@ -// { dg-options "-std=gnu++0x" } -// 2004-12-30 Paolo Carlini -// -// Copyright (C) 2004, 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 -// . - -// -// NB: This file is for testing type_traits with NO OTHER INCLUDES. - -#include - -// { dg-do compile } - -void test01() -{ - // Check for required typedefs - typedef std::has_nothrow_copy_constructor 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; -} Index: testsuite/20_util/has_nothrow_copy_constructor/requirements/explicit_instantiation.cc =================================================================== --- testsuite/20_util/has_nothrow_copy_constructor/requirements/explicit_instantiation.cc (revision 172657) +++ testsuite/20_util/has_nothrow_copy_constructor/requirements/explicit_instantiation.cc (working copy) @@ -1,31 +0,0 @@ -// { dg-options "-std=gnu++0x" } -// { dg-do compile } -// 2007-04-30 Benjamin Kosnik - -// Copyright (C) 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 -// . - - -// NB: This file is for testing type_traits with NO OTHER INCLUDES. - -#include - -namespace std -{ - typedef short test_type; - template struct has_nothrow_copy_constructor; -} Index: testsuite/20_util/is_nothrow_default_constructible/value.cc =================================================================== --- testsuite/20_util/is_nothrow_default_constructible/value.cc (revision 172657) +++ testsuite/20_util/is_nothrow_default_constructible/value.cc (working copy) @@ -1,7 +1,8 @@ // { dg-options "-std=gnu++0x" } // 2004-12-29 Paolo Carlini // -// Copyright (C) 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc. +// 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 @@ -18,8 +19,6 @@ // with this library; see the file COPYING3. If not see // . -// 4.5.3 Type properties - #include #include #include @@ -27,31 +26,45 @@ void test01() { bool test __attribute__((unused)) = true; - using std::has_nothrow_default_constructor; + using std::is_nothrow_default_constructible; using namespace __gnu_test; // Positive tests. - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); - VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + // Negative tests. - VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); } int main() Index: testsuite/20_util/is_nothrow_default_constructible/requirements/typedefs.cc =================================================================== --- testsuite/20_util/is_nothrow_default_constructible/requirements/typedefs.cc (revision 172657) +++ testsuite/20_util/is_nothrow_default_constructible/requirements/typedefs.cc (working copy) @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++0x" } // 2004-12-29 Paolo Carlini // -// 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 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 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; } Index: testsuite/20_util/is_nothrow_default_constructible/requirements/explicit_instantiation.cc =================================================================== --- testsuite/20_util/is_nothrow_default_constructible/requirements/explicit_instantiation.cc (revision 172657) +++ testsuite/20_util/is_nothrow_default_constructible/requirements/explicit_instantiation.cc (working copy) @@ -2,7 +2,7 @@ // { dg-do compile } // 2007-04-30 Benjamin Kosnik -// 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 // . - // NB: This file is for testing type_traits with NO OTHER INCLUDES. #include @@ -27,5 +26,5 @@ namespace std { typedef short test_type; - template struct has_nothrow_default_constructor; + template struct is_nothrow_default_constructible; } Index: testsuite/20_util/is_move_constructible/value.cc =================================================================== --- testsuite/20_util/is_move_constructible/value.cc (revision 0) +++ testsuite/20_util/is_move_constructible/value.cc (revision 0) @@ -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 +// . + +#include +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::is_move_constructible; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + + VERIFY( (test_property(true)) ); + VERIFY( (test_property(true)) ); + VERIFY( (test_property(true)) ); + + // Negative tests. + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + + VERIFY( (test_property(false)) ); + VERIFY( (test_property(false)) ); +} + +int main() +{ + test01(); + return 0; +} Index: testsuite/20_util/is_move_constructible/requirements/typedefs.cc =================================================================== --- testsuite/20_util/is_move_constructible/requirements/typedefs.cc (revision 0) +++ testsuite/20_util/is_move_constructible/requirements/typedefs.cc (revision 0) @@ -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 +// . + +// +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include + +void test01() +{ + // Check for required typedefs + typedef std::is_move_constructible 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; +} Index: testsuite/20_util/is_move_constructible/requirements/explicit_instantiation.cc =================================================================== --- testsuite/20_util/is_move_constructible/requirements/explicit_instantiation.cc (revision 0) +++ testsuite/20_util/is_move_constructible/requirements/explicit_instantiation.cc (revision 0) @@ -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 +// . + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include + +namespace std +{ + typedef short test_type; + template struct is_move_constructible; +} Index: testsuite/20_util/is_copy_constructible/value.cc =================================================================== --- testsuite/20_util/is_copy_constructible/value.cc (revision 0) +++ testsuite/20_util/is_copy_constructible/value.cc (revision 0) @@ -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 +// . + +#include +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::is_copy_constructible; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + + VERIFY( (test_property(true)) ); + VERIFY( (test_property(true)) ); + VERIFY( (test_property(true)) ); + VERIFY( (test_property(true)) ); + + // Negative tests. + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + + VERIFY( (test_property(false)) ); +} + +int main() +{ + test01(); + return 0; +} Index: testsuite/20_util/is_copy_constructible/requirements/typedefs.cc =================================================================== --- testsuite/20_util/is_copy_constructible/requirements/typedefs.cc (revision 0) +++ testsuite/20_util/is_copy_constructible/requirements/typedefs.cc (revision 0) @@ -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 +// . + +// +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include + +void test01() +{ + // Check for required typedefs + typedef std::is_copy_constructible 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; +} Index: testsuite/20_util/is_copy_constructible/requirements/explicit_instantiation.cc =================================================================== --- testsuite/20_util/is_copy_constructible/requirements/explicit_instantiation.cc (revision 0) +++ testsuite/20_util/is_copy_constructible/requirements/explicit_instantiation.cc (revision 0) @@ -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 +// . + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include + +namespace std +{ + typedef short test_type; + template struct is_copy_constructible; +}