re PR libstdc++/35480 (Relational operators for <tr1/tuple> don't error on different sized tuples)

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.

Co-Authored-By: Paolo Carlini <pcarlini@suse.de>

From-SVN: r132984
This commit is contained in:
Chris Jefferson 2008-03-06 18:35:37 +00:00 committed by Paolo Carlini
parent 8d1fc7a4a2
commit d61f49da8f
5 changed files with 80 additions and 4 deletions

View File

@ -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-05 Release Manager
* GCC 4.3.0 released.

View File

@ -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));
}

View File

@ -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));
}

View File

@ -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" }

View File

@ -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" }