This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3] libstdc++/35480


Hi,

tested x86_64-linux, committed to mainline and 4_3-branch.

Paolo.

//////////////////
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.
Index: include/std/tuple
===================================================================
--- include/std/tuple	(revision 132980)
+++ include/std/tuple	(working copy)
@@ -468,7 +468,7 @@
     {
       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 @@
     {
       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));
     }
 
Index: include/tr1/tuple
===================================================================
--- include/tr1/tuple	(revision 132980)
+++ include/tr1/tuple	(working copy)
@@ -329,7 +329,7 @@
     {
       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 @@
     {
       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));
     }
 
Index: testsuite/tr1/6_containers/tuple/comparison_operators/35480.cc
===================================================================
--- testsuite/tr1/6_containers/tuple/comparison_operators/35480.cc	(revision 0)
+++ testsuite/tr1/6_containers/tuple/comparison_operators/35480.cc	(revision 0)
@@ -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" }
Index: testsuite/20_util/tuple/comparison_operators/35480.cc
===================================================================
--- testsuite/20_util/tuple/comparison_operators/35480.cc	(revision 0)
+++ testsuite/20_util/tuple/comparison_operators/35480.cc	(revision 0)
@@ -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" }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]