From a1c1054b5595bc465fe46bd8c9ea340ec84a0918 Mon Sep 17 00:00:00 2001 From: Paolo Carlini <pcarlini@suse.de> Date: Mon, 24 Dec 2007 16:25:49 +0000 Subject: [PATCH] big_tuples.cc: New. 2007-12-24 Paolo Carlini <pcarlini@suse.de> * testsuite/20_util/tuple/cons/big_tuples.cc: New. * testsuite/20_util/tuple/cons/constructor.cc: Likewise. * testsuite/20_util/tuple/cons/assignment.cc: Likewise. * testsuite/20_util/tuple/tuple_element.cc: Likewise. * testsuite/20_util/tuple/tuple_size.cc: Likewise. * testsuite/20_util/tuple/comparison_operators/comparisons.cc: Likewise. * testsuite/20_util/tuple/element_access/get.cc: Likewise. * testsuite/20_util/tuple/creation_functions/23978.cc: Likewise. * testsuite/20_util/tuple/creation_functions/tie.cc: Likewise. * testsuite/20_util/tuple/creation_functions/make_tuple.cc: Likewise. * testsuite/20_util/tuple/requirements/explicit_instantiation.cc: Fix header file and namespace. * testsuite/tr1/6_containers/tuple/cons/big_tuples.cc: Minor tweaks. * testsuite/tr1/6_containers/tuple/cons/constructor.cc: Likewise. * testsuite/tr1/6_containers/tuple/cons/assignment.cc: Likewise. * testsuite/tr1/6_containers/tuple/tuple_element.cc: Likewise. * testsuite/tr1/6_containers/tuple/tuple_size.cc: Likewise. * testsuite/tr1/6_containers/tuple/comparison_operators/ comparisons.cc: Likewise. * testsuite/tr1/6_containers/tuple/element_access/get.cc: Likewise. * testsuite/tr1/6_containers/tuple/creation_functions/tie.cc: Likewise. * testsuite/tr1/6_containers/tuple/creation_functions/make_tuple.cc: Likewise. From-SVN: r131159 --- libstdc++-v3/ChangeLog | 29 +++++ .../tuple/comparison_operators/comparisons.cc | 50 +++++++++ .../20_util/tuple/cons/assignment.cc | 53 +++++++++ .../20_util/tuple/cons/big_tuples.cc | 105 ++++++++++++++++++ .../20_util/tuple/cons/constructor.cc | 65 +++++++++++ .../20_util/tuple/creation_functions/23978.cc | 46 ++++++++ .../tuple/creation_functions/make_tuple.cc | 38 +++++++ .../20_util/tuple/creation_functions/tie.cc | 43 +++++++ .../20_util/tuple/element_access/get.cc | 45 ++++++++ .../requirements/explicit_instantiation.cc | 4 +- .../testsuite/20_util/tuple/tuple_element.cc | 38 +++++++ .../testsuite/20_util/tuple/tuple_size.cc | 39 +++++++ .../tuple/comparison_operators/comparisons.cc | 4 +- .../tr1/6_containers/tuple/cons/assignment.cc | 4 +- .../tr1/6_containers/tuple/cons/big_tuples.cc | 4 +- .../6_containers/tuple/cons/constructor.cc | 4 +- .../tuple/creation_functions/make_tuple.cc | 2 + .../tuple/creation_functions/tie.cc | 4 +- .../6_containers/tuple/element_access/get.cc | 4 +- .../tr1/6_containers/tuple/tuple_element.cc | 4 +- .../tr1/6_containers/tuple/tuple_size.cc | 4 +- 21 files changed, 578 insertions(+), 11 deletions(-) create mode 100644 libstdc++-v3/testsuite/20_util/tuple/comparison_operators/comparisons.cc create mode 100644 libstdc++-v3/testsuite/20_util/tuple/cons/assignment.cc create mode 100644 libstdc++-v3/testsuite/20_util/tuple/cons/big_tuples.cc create mode 100644 libstdc++-v3/testsuite/20_util/tuple/cons/constructor.cc create mode 100644 libstdc++-v3/testsuite/20_util/tuple/creation_functions/23978.cc create mode 100644 libstdc++-v3/testsuite/20_util/tuple/creation_functions/make_tuple.cc create mode 100644 libstdc++-v3/testsuite/20_util/tuple/creation_functions/tie.cc create mode 100644 libstdc++-v3/testsuite/20_util/tuple/element_access/get.cc create mode 100644 libstdc++-v3/testsuite/20_util/tuple/tuple_element.cc create mode 100644 libstdc++-v3/testsuite/20_util/tuple/tuple_size.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 4a342a100450..f88476a41984 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,32 @@ +2007-12-24 Paolo Carlini <pcarlini@suse.de> + + * testsuite/20_util/tuple/cons/big_tuples.cc: New. + * testsuite/20_util/tuple/cons/constructor.cc: Likewise. + * testsuite/20_util/tuple/cons/assignment.cc: Likewise. + * testsuite/20_util/tuple/tuple_element.cc: Likewise. + * testsuite/20_util/tuple/tuple_size.cc: Likewise. + * testsuite/20_util/tuple/comparison_operators/comparisons.cc: + Likewise. + * testsuite/20_util/tuple/element_access/get.cc: Likewise. + * testsuite/20_util/tuple/creation_functions/23978.cc: Likewise. + * testsuite/20_util/tuple/creation_functions/tie.cc: Likewise. + * testsuite/20_util/tuple/creation_functions/make_tuple.cc: Likewise. + + * testsuite/20_util/tuple/requirements/explicit_instantiation.cc: + Fix header file and namespace. + + * testsuite/tr1/6_containers/tuple/cons/big_tuples.cc: Minor tweaks. + * testsuite/tr1/6_containers/tuple/cons/constructor.cc: Likewise. + * testsuite/tr1/6_containers/tuple/cons/assignment.cc: Likewise. + * testsuite/tr1/6_containers/tuple/tuple_element.cc: Likewise. + * testsuite/tr1/6_containers/tuple/tuple_size.cc: Likewise. + * testsuite/tr1/6_containers/tuple/comparison_operators/ + comparisons.cc: Likewise. + * testsuite/tr1/6_containers/tuple/element_access/get.cc: Likewise. + * testsuite/tr1/6_containers/tuple/creation_functions/tie.cc: Likewise. + * testsuite/tr1/6_containers/tuple/creation_functions/make_tuple.cc: + Likewise. + 2007-12-24 Jonathan Wakely <jwakely.gcc@gmail.com> * testsuite/tr1/2_general_utilities/shared_ptr/thread/ diff --git a/libstdc++-v3/testsuite/20_util/tuple/comparison_operators/comparisons.cc b/libstdc++-v3/testsuite/20_util/tuple/comparison_operators/comparisons.cc new file mode 100644 index 000000000000..847785cb02b8 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/comparison_operators/comparisons.cc @@ -0,0 +1,50 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// Tuple + +#include <tuple> +#include <testsuite_hooks.h> + +using namespace std; + +bool test __attribute__((unused)) = true; + +#define TEST1(x) VERIFY( x == x && !(x != x) && x <= x && !(x < x) ) + +int +main() +{ + int i=0; + int j=0; + int k=2; + tuple<int, int, int> a(0, 0, 0); + tuple<int, int, int> b(0, 0, 1); + tuple<int& , int& , int&> c(i,j,k); + tuple<const int&, const int&, const int&> d(c); + TEST1(a); + TEST1(b); + TEST1(c); + TEST1(d); + VERIFY(!(a > a) && !(b > b)); + VERIFY(a >= a && b >= b); + VERIFY(a < b && !(b < a) && a <= b && !(b <= a)); + VERIFY(b > a && !(a > b) && b >= a && !(a >= b)); +} diff --git a/libstdc++-v3/testsuite/20_util/tuple/cons/assignment.cc b/libstdc++-v3/testsuite/20_util/tuple/cons/assignment.cc new file mode 100644 index 000000000000..86defaccf166 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/cons/assignment.cc @@ -0,0 +1,53 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// Tuple + +#include <tuple> +#include <testsuite_hooks.h> + +using namespace std; + +int +main() +{ + bool test __attribute__((unused)) = true; + + tuple<> ta; + tuple<> tb; + ta = tb; + + tuple<int> tc(1); + tuple<int> td(0); + td = tc; + VERIFY(get<0>(td) == 1); + + int i=0; + tuple<int&> te(i); + te = tc; + VERIFY(i == 1); + + tuple<const int&> tf(tc); + + get<0>(tc) = 2; + VERIFY(get<0>(tf) == 2); + tuple<double> tg; + tg = tc; +} diff --git a/libstdc++-v3/testsuite/20_util/tuple/cons/big_tuples.cc b/libstdc++-v3/testsuite/20_util/tuple/cons/big_tuples.cc new file mode 100644 index 000000000000..938e4cb48d47 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/cons/big_tuples.cc @@ -0,0 +1,105 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// Tuple + +#include <tuple> +#include <testsuite_hooks.h> + +using namespace std; + +// A simple class without conversions to check some things +struct foo +{ }; + +void +test_constructors() +{ + bool test __attribute__((unused)) = true; + + int x1=0,x2=0; + const int &z1=x1; + + // Test empty constructor + tuple<> ta; + tuple<int,int> tb; + // Test construction from values + tuple<int,int> tc(x1,x2); + tuple<int,int&> td(x1,x2); + tuple<const int&> te(z1); + x1=1; + x2=1; + VERIFY(get<0>(td) == 0 && get<1>(td) == 1 && get<0>(te) == 1); + + // Test identical tuple copy constructor + tuple<int,int> tf(tc); + tuple<int,int> tg(td); + tuple<const int&> th(te); + // Test different tuple copy constructor + tuple<int,double> ti(tc); + tuple<int,double> tj(td); + // Test constructing from a pair + pair<int,int> pair1(1,1); + const pair<int,int> pair2(pair1); + tuple<int,int> tl(pair1); + tuple<int,const int&> tm(pair1); + tuple<int,int> tn(pair2); + tuple<int,const int&> to(pair2); +} + +int +main(void) +{ + //test construction + typedef tuple<int,int,int,int,int,int,int,int,int,int> type1; + type1 a(0, 0, 0, 0, 0, 0, 0, 0, 0, 1); + type1 b(0, 0, 0, 0, 0, 0, 0, 0, 0, 2); + type1 c(a); + typedef tuple<int,int,int,int,int,int,int,int,int,char> type2; + type2 d(0, 0, 0, 0, 0, 0, 0, 0, 0, 3); + type1 e(d); + typedef tuple<foo,int,int,int,int,int,int,int,int,foo> type3; + // get + VERIFY(get<9>(a)==1 && get<9>(b)==2); + // comparisons + VERIFY(a==a && !(a!=a) && a<=a && a>=a && !(a<a) && !(a>a)); + VERIFY(!(a==b) && a!=b && a<=b && a<b && !(a>=b) && !(a>b)); + //tie + { + int i = 0; + tie(ignore, ignore, ignore, ignore, ignore, ignore, ignore, ignore, + ignore, i) = a; + VERIFY(i == 1); + } + //test_assignment + a=d; + a=b; + //make_tuple + make_tuple(0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + + //tuple_size + VERIFY(tuple_size<type3>::value == 10); + //tuple_element + { + foo q1; + tuple_element<0,type3>::type q2(q1); + tuple_element<9,type3>::type q3(q1); + } +} diff --git a/libstdc++-v3/testsuite/20_util/tuple/cons/constructor.cc b/libstdc++-v3/testsuite/20_util/tuple/cons/constructor.cc new file mode 100644 index 000000000000..8440413d930c --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/cons/constructor.cc @@ -0,0 +1,65 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// Tuple + +#include <tuple> +#include <testsuite_hooks.h> + +using namespace std; + +int +main() +{ + bool test __attribute__((unused)) = true; + + int x1=0,x2=0; + const int &z1=x1; + + // Test empty constructor + tuple<> ta; + tuple<int,int> tb; + // Test construction from values + tuple<int,int> tc(x1,x2); + tuple<int,int&> td(x1,x2); + tuple<const int&> te(z1); + x1=1; + x2=1; + VERIFY(get<0>(td) == 0 && get<1>(td) == 1 && get<0>(te) == 1); + + // Test identical tuple copy constructor + tuple<int,int> tf(tc); + tuple<int,int> tg(td); + tuple<const int&> th(te); + // Test different tuple copy constructor + tuple<int,double> ti(tc); + tuple<int,double> tj(td); + //tuple<int&, int&> tk(tc); + tuple<const int&, const int&> tl(tc); + tuple<const int&, const int&> tm(tl); + // Test constructing from a pair + pair<int,int> pair1(1,1); + const pair<int,int> pair2(pair1); + tuple<int,int> tn(pair1); + tuple<int,const int&> to(pair1); + tuple<int,int> tp(pair2); + tuple<int,const int&> tq(pair2); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/tuple/creation_functions/23978.cc b/libstdc++-v3/testsuite/20_util/tuple/creation_functions/23978.cc new file mode 100644 index 000000000000..edb4aef61b05 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/creation_functions/23978.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=gnu++0x" } +// +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// Tuple + +#include <tuple> +#include <utility> +#include <testsuite_hooks.h> + +using namespace std; + +// libstdc++/23978 +void test01() +{ + bool test __attribute__((unused)) = true; + + pair<int, int> p(1, 2); + int x = 0; + int y = 0; + tie(x, y) = p; + VERIFY( x == 1 && y == 2 ); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/tuple/creation_functions/make_tuple.cc b/libstdc++-v3/testsuite/20_util/tuple/creation_functions/make_tuple.cc new file mode 100644 index 000000000000..a6eba6d41543 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/creation_functions/make_tuple.cc @@ -0,0 +1,38 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// Tuple + +#include <tuple> +#include <functional> +#include <testsuite_hooks.h> + +using namespace std; + +int +main() +{ + bool test __attribute__((unused)) = true; + + int i=0; + make_tuple(1,2,4.0); + make_tuple(ref(i)) = tuple<int>(1); + VERIFY(i == 1); +} diff --git a/libstdc++-v3/testsuite/20_util/tuple/creation_functions/tie.cc b/libstdc++-v3/testsuite/20_util/tuple/creation_functions/tie.cc new file mode 100644 index 000000000000..e7f5c056e4ee --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/creation_functions/tie.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// Tuple + +#include <tuple> +#include <testsuite_hooks.h> + +using namespace std; + +int +main() +{ + bool test __attribute__((unused)) = true; + + int x1 = 0; + int x2 = 0; + int y1 = 0; + int y2 = 0; + tuple<int,int> ta(1,1); + tuple<const int&,const int&> tc(x1,x2); + tie(y1,y2)=ta; + VERIFY(y1 == 1 && y2 == 1); + tie(y1,y2)=tc; + VERIFY(y1 == 0 && y2 == 0); +} diff --git a/libstdc++-v3/testsuite/20_util/tuple/element_access/get.cc b/libstdc++-v3/testsuite/20_util/tuple/element_access/get.cc new file mode 100644 index 000000000000..32015ee7da6c --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/element_access/get.cc @@ -0,0 +1,45 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// Tuple + +#include <tuple> +#include <testsuite_hooks.h> + +using namespace std; + +int +main() +{ + bool test __attribute__((unused)) = true; + + int j=1; + const int k=2; + tuple<int,int &,const int&> a(0,j,k); + const tuple<int,int &,const int&> b(1,j,k); + VERIFY(get<0>(a)==0 && get<1>(a)==1 && get<2>(a)==2); + get<0>(a)=3; + get<1>(a)=4; + VERIFY(get<0>(a)==3 && get<1>(a)==4); + VERIFY(j==4); + get<1>(b)=5; + VERIFY(get<0>(b)==1 && get<1>(b)==5 && get<2>(b)==2); + VERIFY(j==5); +} diff --git a/libstdc++-v3/testsuite/20_util/tuple/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/tuple/requirements/explicit_instantiation.cc index 55afcc86fdb5..29b886d1266c 100644 --- a/libstdc++-v3/testsuite/20_util/tuple/requirements/explicit_instantiation.cc +++ b/libstdc++-v3/testsuite/20_util/tuple/requirements/explicit_instantiation.cc @@ -28,6 +28,6 @@ // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. -#include <tr1/tuple> +#include <tuple> -template class std::tr1::tuple<short, int, double>; +template class std::tuple<short, int, double>; diff --git a/libstdc++-v3/testsuite/20_util/tuple/tuple_element.cc b/libstdc++-v3/testsuite/20_util/tuple/tuple_element.cc new file mode 100644 index 000000000000..1b78a5ca2bbb --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/tuple_element.cc @@ -0,0 +1,38 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// Tuple + +#include <tuple> + +using namespace std; + +struct foo +{ }; + +int +main() +{ + // As foo isn't constructible from anything else, this + // lets us check if type is returning foo when it should + foo q1; + tuple_element<0,tuple<foo,void,int> >::type q2(q1); + tuple_element<2,tuple<void,int,foo> >::type q3(q1); +} diff --git a/libstdc++-v3/testsuite/20_util/tuple/tuple_size.cc b/libstdc++-v3/testsuite/20_util/tuple/tuple_size.cc new file mode 100644 index 000000000000..f5f398ce0a11 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/tuple_size.cc @@ -0,0 +1,39 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// Tuple + +#include <tuple> +#include <testsuite_hooks.h> + +using namespace std; + +int +main() +{ + bool test __attribute__((unused)) = true; + + VERIFY(tuple_size<tuple<> >::value == 0); + VERIFY(tuple_size<tuple<int> >::value == 1); + VERIFY(tuple_size<tuple<void> >::value == 1); + typedef tuple<int,const int&,void> test_tuple1; + VERIFY(tuple_size<test_tuple1>::value == 3); + VERIFY(tuple_size<tuple<tuple<void> > >::value == 1); +} diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/comparison_operators/comparisons.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/comparison_operators/comparisons.cc index f22d975c86b4..7eee7a8d12d7 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/tuple/comparison_operators/comparisons.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/comparison_operators/comparisons.cc @@ -1,6 +1,6 @@ // 2004-09-23 Chris Jefferson <chris@bubblescope.net> -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007 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,6 +25,8 @@ using namespace std::tr1; +bool test __attribute__((unused)) = true; + #define TEST1(x) VERIFY( x == x && !(x != x) && x <= x && !(x < x) ) int diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/assignment.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/assignment.cc index 6207b41f9dfe..973b5f0ce313 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/assignment.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/assignment.cc @@ -1,6 +1,6 @@ // 2004-09-23 Chris Jefferson <chris@bubblescope.net> -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007 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,6 +28,8 @@ using namespace std::tr1; int main() { + bool test __attribute__((unused)) = true; + tuple<> ta; tuple<> tb; ta = tb; diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/big_tuples.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/big_tuples.cc index a23ad8dbc74e..2af47e5bd170 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/big_tuples.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/big_tuples.cc @@ -1,6 +1,6 @@ // 2004-09-23 Chris Jefferson <chris@bubblescope.net> -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007 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 @@ -33,6 +33,8 @@ struct foo void test_constructors() { + bool test __attribute__((unused)) = true; + int x1=0,x2=0; const int &z1=x1; diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/constructor.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/constructor.cc index 89e9a113ffa1..de34ba44809f 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/constructor.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/constructor.cc @@ -1,6 +1,6 @@ // 2004-09-23 Chris Jefferson <chris@bubblescope.net> -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007 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 @@ -29,6 +29,8 @@ using std::pair; int main() { + bool test __attribute__((unused)) = true; + int x1=0,x2=0; const int &z1=x1; diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/make_tuple.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/make_tuple.cc index ca69be21f0e0..9a0fc6f6dae1 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/make_tuple.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/make_tuple.cc @@ -29,6 +29,8 @@ using namespace std::tr1; int main() { + bool test __attribute__((unused)) = true; + int i=0; make_tuple(1,2,4.0); make_tuple(ref(i)) = tuple<int>(1); diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/tie.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/tie.cc index ea63a5d5c6a4..d8389be410db 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/tie.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/tie.cc @@ -1,6 +1,6 @@ // 2004-09-23 Chris Jefferson <chris@bubblescope.net> -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007 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,6 +28,8 @@ using namespace std::tr1; int main() { + bool test __attribute__((unused)) = true; + int x1 = 0; int x2 = 0; int y1 = 0; diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/element_access/get.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/element_access/get.cc index 85ec6cb10dc1..5cfda1486340 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/tuple/element_access/get.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/element_access/get.cc @@ -1,6 +1,6 @@ // 2004-09-23 Chris Jefferson <chris@bubblescope.net> -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007 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,6 +28,8 @@ using namespace std::tr1; int main() { + bool test __attribute__((unused)) = true; + int j=1; const int k=2; tuple<int,int &,const int&> a(0,j,k); diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/tuple_element.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/tuple_element.cc index 44a93171e850..6178e567699d 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/tuple/tuple_element.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/tuple_element.cc @@ -1,6 +1,6 @@ // 2004-09-23 Chris Jefferson <chris@bubblescope.net> -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007 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,7 +31,7 @@ struct foo int main() { - // As foo isn't constructable from anything else, this + // As foo isn't constructible from anything else, this // lets us check if type is returning foo when it should foo q1; tuple_element<0,tuple<foo,void,int> >::type q2(q1); diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/tuple_size.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/tuple_size.cc index 967cb43d95cc..73389373b262 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/tuple/tuple_size.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/tuple_size.cc @@ -1,6 +1,6 @@ // 2004-09-23 Chris Jefferson <chris@bubblescope.net> -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007 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,6 +28,8 @@ using namespace std::tr1; int main() { + bool test __attribute__((unused)) = true; + VERIFY(tuple_size<tuple<> >::value == 0); VERIFY(tuple_size<tuple<int> >::value == 1); VERIFY(tuple_size<tuple<void> >::value == 1); -- GitLab