diff options
author | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-10-18 08:36:06 +0000 |
---|---|---|
committer | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-10-18 08:36:06 +0000 |
commit | a558fd42873865cc1e93a5916713f850c510d76e (patch) | |
tree | 4b2998e8222d758131a6b3f6b82324e81255caff /libstdc++-v3/testsuite | |
parent | ef5c7840b2f35bc1d07401510d60f458bcfc23cd (diff) | |
download | ppe42-gcc-a558fd42873865cc1e93a5916713f850c510d76e.tar.gz ppe42-gcc-a558fd42873865cc1e93a5916713f850c510d76e.zip |
2012-10-17 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/move.h (move_if_noexcept): Mark constexpr.
* include/std/array (front, back): Same.
* include/std/chrono: Add comment.
* include/std/tuple (__tuple_compare): Mark __eq, __less constexpr.
(operator ==, <, >, !=, <=, >=): Same.
* testsuite/20_util/forward/c_neg.cc: Adjust line numbers.
* testsuite/20_util/forward/f_neg.cc: Same.
* testsuite/20_util/move_if_noexcept/constexpr.cc: New.
* testsuite/20_util/tuple/comparison_operators/constexpr.cc: New.
* testsuite/20_util/tuple/creation_functions/constexpr.cc: Add.
* testsuite/23_containers/array/element_access/
constexpr_element_access.cc: Same.
* testsuite/23_containers/array/tuple_interface/get_neg.cc: Adjust
line numbers.
* testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc:
Same.
* testsuite/20_util/tuple/comparison_operators/35480_neg.cc:
Temporarily add dg-excess-errors.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192556 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite')
9 files changed, 129 insertions, 11 deletions
diff --git a/libstdc++-v3/testsuite/20_util/forward/c_neg.cc b/libstdc++-v3/testsuite/20_util/forward/c_neg.cc index 01128245d7e..1e573ec2757 100644 --- a/libstdc++-v3/testsuite/20_util/forward/c_neg.cc +++ b/libstdc++-v3/testsuite/20_util/forward/c_neg.cc @@ -1,7 +1,7 @@ // { dg-do compile } // { dg-options "-std=gnu++0x" } -// Copyright (C) 2010, 2011 Free Software Foundation, Inc. +// Copyright (C) 2010-2012 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,7 +18,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-error "static assertion failed" "" { target *-*-* } 90 } +// { dg-error "static assertion failed" "" { target *-*-* } 89 } #include <list> diff --git a/libstdc++-v3/testsuite/20_util/forward/f_neg.cc b/libstdc++-v3/testsuite/20_util/forward/f_neg.cc index 9e5b78a04db..d4a9c7a2af6 100644 --- a/libstdc++-v3/testsuite/20_util/forward/f_neg.cc +++ b/libstdc++-v3/testsuite/20_util/forward/f_neg.cc @@ -1,7 +1,7 @@ // { dg-do compile } // { dg-options "-std=gnu++0x" } -// Copyright (C) 2010, 2011 Free Software Foundation, Inc. +// Copyright (C) 2010-2012 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,7 +18,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-error "static assertion failed" "" { target *-*-* } 90 } +// { dg-error "static assertion failed" "" { target *-*-* } 89 } #include <utility> diff --git a/libstdc++-v3/testsuite/20_util/move_if_noexcept/constexpr.cc b/libstdc++-v3/testsuite/20_util/move_if_noexcept/constexpr.cc new file mode 100644 index 00000000000..4811b17cbd9 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/move_if_noexcept/constexpr.cc @@ -0,0 +1,42 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2012 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 <utility> +#include <testsuite_hooks.h> + +struct simple +{ + int i; +}; + +void +test01() +{ + bool test __attribute__((unused)) = true; + + constexpr simple s { 5 }; + constexpr auto s2 __attribute__((unused)) = std::move_if_noexcept(s); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/tuple/comparison_operators/35480_neg.cc b/libstdc++-v3/testsuite/20_util/tuple/comparison_operators/35480_neg.cc index eb22938261a..eb4c213eddb 100644 --- a/libstdc++-v3/testsuite/20_util/tuple/comparison_operators/35480_neg.cc +++ b/libstdc++-v3/testsuite/20_util/tuple/comparison_operators/35480_neg.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++0x" } // { dg-do compile } -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// Copyright (C) 2008, 2009, 2012 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 @@ -31,3 +31,4 @@ void test01() if ( t1 == t2 ) {} // { dg-error "here" } } // { dg-prune-output "incomplete type" } +// { dg-excess-errors "body of constexpr function" } diff --git a/libstdc++-v3/testsuite/20_util/tuple/comparison_operators/constexpr.cc b/libstdc++-v3/testsuite/20_util/tuple/comparison_operators/constexpr.cc new file mode 100644 index 00000000000..0efb4c3da91 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/comparison_operators/constexpr.cc @@ -0,0 +1,29 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2012 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 <tuple> +#include <testsuite_common_types.h> + +int main() +{ + __gnu_test::constexpr_comparison_operators test; + test.operator()<std::tuple<int, int>>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/tuple/creation_functions/constexpr.cc b/libstdc++-v3/testsuite/20_util/tuple/creation_functions/constexpr.cc index bf2a8573abf..6c260605c05 100644 --- a/libstdc++-v3/testsuite/20_util/tuple/creation_functions/constexpr.cc +++ b/libstdc++-v3/testsuite/20_util/tuple/creation_functions/constexpr.cc @@ -1,7 +1,7 @@ // { dg-do compile } // { dg-options "-std=gnu++0x" } -// Copyright (C) 2011 Free Software Foundation, Inc. +// Copyright (C) 2011, 2012 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 @@ -45,6 +45,50 @@ test_make_tuple() } } +#if 0 +// forward_as_tuple +void +test_forward_as_tuple() +{ + { + typedef std::tuple<int, float> tuple_type; + constexpr tuple_type p1 __attribute__((unused)) + = std::forward_as_tuple(22, 22.222); + } + + { + typedef std::tuple<int, float, int> tuple_type; + constexpr tuple_type p1 __attribute__((unused)) + = std::forward_as_tuple(22, 22.222, 77799); + } +} +#endif + +#if 0 +// tie +void +test_tie() +{ + { + int i(22); + float f(22.222); + typedef std::tuple<int, float> tuple_type; + constexpr tuple_type p1 __attribute__((unused)) + = std::tie(i, f); + } + + { + int i(22); + float f(22.222); + int ii(77799); + + typedef std::tuple<int, float, int> tuple_type; + constexpr tuple_type p1 __attribute__((unused)) + = std::tie(i, f, ii); + } +} +#endif + // get void test_get() diff --git a/libstdc++-v3/testsuite/23_containers/array/element_access/constexpr_element_access.cc b/libstdc++-v3/testsuite/23_containers/array/element_access/constexpr_element_access.cc index c2f301adcd4..ec46ac0d388 100644 --- a/libstdc++-v3/testsuite/23_containers/array/element_access/constexpr_element_access.cc +++ b/libstdc++-v3/testsuite/23_containers/array/element_access/constexpr_element_access.cc @@ -1,7 +1,7 @@ // { dg-do compile } // { dg-options "-std=gnu++0x" } -// Copyright (C) 2011 Free Software Foundation, Inc. +// Copyright (C) 2011-2012 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 @@ -27,5 +27,7 @@ int main() constexpr array_type a = { { 0, 55, 66, 99, 4115, 2 } }; constexpr auto v1 __attribute__((unused)) = a[1]; constexpr auto v2 __attribute__((unused)) = a.at(2); + constexpr auto v3 __attribute__((unused)) = a.front(); + constexpr auto v4 __attribute__((unused)) = a.back(); return 0; } diff --git a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc index e74af1b4f43..7c7a365cb4e 100644 --- a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc @@ -27,6 +27,6 @@ int n1 = std::get<1>(a); int n2 = std::get<1>(std::move(a)); int n3 = std::get<1>(ca); -// { dg-error "static assertion failed" "" { target *-*-* } 288 } -// { dg-error "static assertion failed" "" { target *-*-* } 296 } -// { dg-error "static assertion failed" "" { target *-*-* } 304 } +// { dg-error "static assertion failed" "" { target *-*-* } 291 } +// { dg-error "static assertion failed" "" { target *-*-* } 299 } +// { dg-error "static assertion failed" "" { target *-*-* } 307 } diff --git a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc index b9ce910f61a..3c642c800b0 100644 --- a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc @@ -22,4 +22,4 @@ typedef std::tuple_element<1, std::array<int, 1>>::type type; -// { dg-error "static assertion failed" "" { target *-*-* } 280 } +// { dg-error "static assertion failed" "" { target *-*-* } 283 } |