diff options
author | Daniel Krugler <daniel.kruegler@googlemail.com> | 2011-09-11 22:10:21 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2011-09-11 22:10:21 +0000 |
commit | ac65b7d221231caa58b02a619da018dbbaa6a3e5 (patch) | |
tree | fc1dd8d8b32c5967145919371cb46e76351d1c2b /libstdc++-v3/testsuite | |
parent | fa11ae6c728fdde8746fc77107c3a1095ac88f59 (diff) | |
download | gcc-ac65b7d221231caa58b02a619da018dbbaa6a3e5.zip gcc-ac65b7d221231caa58b02a619da018dbbaa6a3e5.tar.gz gcc-ac65b7d221231caa58b02a619da018dbbaa6a3e5.tar.bz2 |
re PR libstdc++/50159 ([C++0x] tuple_cat only accepts two arguments)
2011-09-11 Daniel Krugler <daniel.kruegler@googlemail.com>
PR libstdc++/50159
* include/std/tuple (tuple_cat): Reimplement according to the
resolution of LWG 1385.
* include/std/type_traits: Define __and_ and __or_ for zero
arguments too; minor tweaks.
* testsuite/20_util/tuple/creation_functions/tuple_cat.cc: New.
* testsuite/20_util/tuple/creation_functions/constexpr.cc: Disable
for now tuple_cat test.
* testsuite/20_util/declval/requirements/1_neg.cc: Adjust dg-error
line numbers.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Likewise.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
Likewise.
* doc/xml/manual/status_cxx200x.xml: Update.
From-SVN: r178770
Diffstat (limited to 'libstdc++-v3/testsuite')
5 files changed, 140 insertions, 6 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 a5f4b28..195b9c2 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 *-*-* } 1725 } +// { dg-error "static assertion failed" "" { target *-*-* } 1731 } #include <utility> 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 f37d4fb..b3266580 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 "required from here" "" { target *-*-* } 40 } // { dg-error "required from here" "" { target *-*-* } 42 } -// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1511 } -// { dg-error "declaration of" "" { target *-*-* } 1475 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1517 } +// { dg-error "declaration of" "" { target *-*-* } 1481 } 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 497f170..3de08b3 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 "required from here" "" { target *-*-* } 40 } // { dg-error "required from here" "" { target *-*-* } 42 } -// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1435 } -// { dg-error "declaration of" "" { target *-*-* } 1399 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1441 } +// { dg-error "declaration of" "" { target *-*-* } 1405 } 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 a5b5441..82bbe1f 100644 --- a/libstdc++-v3/testsuite/20_util/tuple/creation_functions/constexpr.cc +++ b/libstdc++-v3/testsuite/20_util/tuple/creation_functions/constexpr.cc @@ -63,6 +63,7 @@ test_get() } // tuple_cat +#if 0 void test_tuple_cat() { @@ -73,7 +74,7 @@ test_tuple_cat() constexpr tuple_type2 t2 { 55, 99, 77.77 }; constexpr auto cat1 = std::tuple_cat(t1, t2); } - +#endif int main() @@ -84,7 +85,9 @@ main() test_get(); +#if 0 test_tuple_cat(); +#endif return 0; } diff --git a/libstdc++-v3/testsuite/20_util/tuple/creation_functions/tuple_cat.cc b/libstdc++-v3/testsuite/20_util/tuple/creation_functions/tuple_cat.cc new file mode 100644 index 0000000..b2279a1 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/creation_functions/tuple_cat.cc @@ -0,0 +1,131 @@ +// { 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/>. + +// Tuple + +#include <tuple> +#include <array> + +static_assert(std::is_same<decltype(std::tuple_cat()), + std::tuple<>>::value, "Error"); +static_assert(std::is_same<decltype(std::tuple_cat + (std::declval<std::tuple<>>())), + std::tuple<>>::value, "Error"); +static_assert(std::is_same<decltype(std::tuple_cat + (std::declval<std::tuple<>&>())), + std::tuple<>>::value, "Error"); +static_assert(std::is_same<decltype(std::tuple_cat + (std::declval<const std::tuple<>>())), + std::tuple<>>::value, "Error"); +static_assert(std::is_same<decltype(std::tuple_cat + (std::declval<const std::tuple<>&>())), + std::tuple<>>::value, "Error"); +static_assert(std::is_same<decltype(std::tuple_cat + (std::declval<std::pair<int, bool>>())), + std::tuple<int, bool>>::value, "Error"); +static_assert(std::is_same<decltype(std::tuple_cat + (std::declval<std::pair<int, bool>&>())), + std::tuple<int, bool>>::value, "Error"); +static_assert(std::is_same<decltype + (std::tuple_cat(std::declval<const std::pair<int, bool>>())), + std::tuple<int, bool>>::value, "Error"); +static_assert(std::is_same<decltype + (std::tuple_cat(std::declval<const std::pair<int, bool>&>())), + std::tuple<int, bool>>::value, "Error"); +static_assert(std::is_same<decltype + (std::tuple_cat(std::declval<std::array<int, 3>>())), + std::tuple<int, int, int>>::value, "Error"); +static_assert(std::is_same<decltype + (std::tuple_cat(std::declval<std::array<int, 3>&>())), + std::tuple<int, int, int>>::value, "Error"); +static_assert(std::is_same<decltype + (std::tuple_cat(std::declval<const std::array<int, 3>>())), + std::tuple<int, int, int>>::value, "Error"); +static_assert(std::is_same<decltype + (std::tuple_cat(std::declval<const std::array<int, 3>&>())), + std::tuple<int, int, int>>::value, "Error"); +static_assert(std::is_same<decltype + (std::tuple_cat + (std::declval<std::tuple<>>(), std::declval<std::tuple<>>())), + std::tuple<>>::value, "Error"); +static_assert(std::is_same<decltype + (std::tuple_cat + (std::declval<std::tuple<>>(), std::declval<std::tuple<>>(), + std::declval<std::tuple<>>())), std::tuple<>>::value, "Error"); +static_assert(std::is_same<decltype + (std::tuple_cat + (std::declval<std::tuple<>>(), + std::declval<std::array<char, 0>>(), + std::declval<std::array<int, 0>>(), + std::declval<std::tuple<>>())), std::tuple<>>::value, "Error"); +static_assert(std::is_same<decltype + (std::tuple_cat + (std::declval<std::tuple<int>>(), + std::declval<std::tuple<double>>())), + std::tuple<int, double>>::value, "Error"); +static_assert(std::is_same<decltype + (std::tuple_cat + (std::declval<std::tuple<int>>(), + std::declval<std::tuple<double>>(), + std::declval<std::tuple<const long&>>())), + std::tuple<int, double, const long&>>::value, "Error"); +static_assert(std::is_same<decltype + (std::tuple_cat + (std::declval<std::array<wchar_t, 3>&>(), + std::declval<std::tuple<double>>(), + std::declval<std::tuple<>>(), + std::declval<std::tuple<unsigned&>>(), + std::declval<std::pair<bool, std::nullptr_t>>())), + std::tuple<wchar_t, wchar_t, wchar_t, + double, unsigned&, bool, std::nullptr_t> + >::value, "Error"); + +int main() +{ + std::tuple_cat(); + std::tuple_cat(std::tuple<>{ }); + std::tuple_cat(std::tuple<>{ }, std::tuple<>{ }); + std::array<int, 3> a3; + std::tuple_cat(a3); + std::pair<double, bool> pdb; + std::tuple<unsigned, float, std::nullptr_t, void*> t; + int i{ }; + double d{ }; + int* pi{ }; + std::tuple<int&, double&, int*&> to{i, d, pi}; + std::tuple_cat(pdb); + std::tuple_cat(to); + std::tuple_cat(to, to); + std::tuple_cat(a3, pdb); + std::tuple_cat(a3, pdb, t); + std::tuple_cat(a3, pdb, t, a3); + std::tuple_cat(a3, pdb, t, a3, pdb, t); + + static_assert(std::is_same<decltype + (std::tuple_cat(a3, pdb, t, a3, pdb, t)), + std::tuple<int, int, int, double, bool, + unsigned, float, std::nullptr_t, void*, + int, int, int, double, bool, unsigned, + float, std::nullptr_t, void*> + >::value, "Error"); + + std::tuple_cat(std::tuple<int, char, void*>{}, to, a3, + std::tuple<>{}, std::pair<float, + std::nullptr_t>{}, pdb, to); +} |