diff options
-rw-r--r-- | libstdc++-v3/ChangeLog | 9 | ||||
-rw-r--r-- | libstdc++-v3/include/std/tuple | 4 | ||||
-rw-r--r-- | libstdc++-v3/include/tr1/tuple | 4 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/20_util/tuple/comparison_operators/35480.cc | 34 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/tr1/6_containers/tuple/comparison_operators/35480.cc | 33 |
5 files changed, 80 insertions, 4 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index b8f16da3f98..58ed25737e3 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2008-03-06 Chris Jefferson <chris@bubblescope.net> + Paolo Carlini <pcarlini@suse.de> + + 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 <joseph@codesourcery.com> * crossconfig.m4 (*-mingw32*): Define HAVE_STRTOF and diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index b870234c129..78f69deee13 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<tuple_size<_Tp>::value - tuple_size<_Tp>::value, + return (__tuple_compare<tuple_size<_Tp>::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<tuple_size<_Tp>::value - tuple_size<_Tp>::value, + return (__tuple_compare<tuple_size<_Tp>::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 ae6a36cd066..e4185e26555 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<tuple_size<_Tp>::value - tuple_size<_Tp>::value, + return (__tuple_compare<tuple_size<_Tp>::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<tuple_size<_Tp>::value - tuple_size<_Tp>::value, + return (__tuple_compare<tuple_size<_Tp>::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 00000000000..969fc650095 --- /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 <tuple> + +// libstdc++/35480 +void test01() +{ + std::tuple<int> t1( 1 ); + std::tuple<int, int> 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 00000000000..effa3da6326 --- /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 <tr1/tuple> + +// libstdc++/35480 +void test01() +{ + std::tr1::tuple<int> t1( 1 ); + std::tr1::tuple<int, int> t2( 1, 2 ); + if ( t1 < t2 ) {} // { dg-error "here" } + if ( t1 == t2 ) {} // { dg-error "here" } +} +// { dg-excess-errors "incomplete type" } |