From 230636fe5ecfa4e80550e1906e38228b8213efff Mon Sep 17 00:00:00 2001 From: Chris Jefferson Date: Thu, 6 Mar 2008 18:35:26 +0000 Subject: [PATCH] re PR libstdc++/35480 (Relational operators for don't error on different sized tuples) 2008-03-06 Chris Jefferson Paolo Carlini PR libstdc++/35480 * include/tr1/tuple (operator==, operator<): Fix. * include/std/tuple (operator==, operator<): Likewise. * testsuite/tr1/6_containers/tuple/comparison_operators/35480.cc: New. * testsuite/20_util/tuple/comparison_operators/35480.cc: Likewise. Co-Authored-By: Paolo Carlini From-SVN: r132983 --- libstdc++-v3/ChangeLog | 9 ++++++ libstdc++-v3/include/std/tuple | 4 +-- libstdc++-v3/include/tr1/tuple | 4 +-- .../20_util/tuple/comparison_operators/35480.cc | 34 ++++++++++++++++++++++ .../tuple/comparison_operators/35480.cc | 33 +++++++++++++++++++++ 5 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 libstdc++-v3/testsuite/20_util/tuple/comparison_operators/35480.cc create mode 100644 libstdc++-v3/testsuite/tr1/6_containers/tuple/comparison_operators/35480.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index b8f16da..58ed257 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2008-03-06 Chris Jefferson + Paolo Carlini + + PR libstdc++/35480 + * include/tr1/tuple (operator==, operator<): Fix. + * include/std/tuple (operator==, operator<): Likewise. + * testsuite/tr1/6_containers/tuple/comparison_operators/35480.cc: New. + * testsuite/20_util/tuple/comparison_operators/35480.cc: Likewise. + 2008-03-04 Joseph Myers * crossconfig.m4 (*-mingw32*): Define HAVE_STRTOF and diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index b870234..78f69de 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -468,7 +468,7 @@ namespace std { typedef tuple<_TElements...> _Tp; typedef tuple<_UElements...> _Up; - return (__tuple_compare::value - tuple_size<_Tp>::value, + return (__tuple_compare::value - tuple_size<_Up>::value, 0, tuple_size<_Tp>::value, _Tp, _Up>::__eq(__t, __u)); } @@ -479,7 +479,7 @@ namespace std { typedef tuple<_TElements...> _Tp; typedef tuple<_UElements...> _Up; - return (__tuple_compare::value - tuple_size<_Tp>::value, + return (__tuple_compare::value - tuple_size<_Up>::value, 0, tuple_size<_Tp>::value, _Tp, _Up>::__less(__t, __u)); } diff --git a/libstdc++-v3/include/tr1/tuple b/libstdc++-v3/include/tr1/tuple index ae6a36c..e4185e2 100644 --- a/libstdc++-v3/include/tr1/tuple +++ b/libstdc++-v3/include/tr1/tuple @@ -329,7 +329,7 @@ namespace tr1 { typedef tuple<_TElements...> _Tp; typedef tuple<_UElements...> _Up; - return (__tuple_compare::value - tuple_size<_Tp>::value, + return (__tuple_compare::value - tuple_size<_Up>::value, 0, tuple_size<_Tp>::value, _Tp, _Up>::__eq(__t, __u)); } @@ -340,7 +340,7 @@ namespace tr1 { typedef tuple<_TElements...> _Tp; typedef tuple<_UElements...> _Up; - return (__tuple_compare::value - tuple_size<_Tp>::value, + return (__tuple_compare::value - tuple_size<_Up>::value, 0, tuple_size<_Tp>::value, _Tp, _Up>::__less(__t, __u)); } diff --git a/libstdc++-v3/testsuite/20_util/tuple/comparison_operators/35480.cc b/libstdc++-v3/testsuite/20_util/tuple/comparison_operators/35480.cc new file mode 100644 index 0000000..969fc65 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/comparison_operators/35480.cc @@ -0,0 +1,34 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2008 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 + +// libstdc++/35480 +void test01() +{ + std::tuple t1( 1 ); + std::tuple t2( 1, 2 ); + if ( t1 < t2 ) {} // { dg-error "here" } + if ( t1 == t2 ) {} // { dg-error "here" } +} +// { dg-excess-errors "incomplete type" } diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/comparison_operators/35480.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/comparison_operators/35480.cc new file mode 100644 index 0000000..effa3da --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/comparison_operators/35480.cc @@ -0,0 +1,33 @@ +// { dg-do compile } + +// Copyright (C) 2008 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 + +// libstdc++/35480 +void test01() +{ + std::tr1::tuple t1( 1 ); + std::tr1::tuple t2( 1, 2 ); + if ( t1 < t2 ) {} // { dg-error "here" } + if ( t1 == t2 ) {} // { dg-error "here" } +} +// { dg-excess-errors "incomplete type" } -- 2.7.4