OSDN Git Service

2008-03-06 Chris Jefferson <chris@bubblescope.net>
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 6 Mar 2008 18:35:26 +0000 (18:35 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 6 Mar 2008 18:35:26 +0000 (18:35 +0000)
    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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@132983 138bc75d-0d04-0410-961f-82ee72b054a4

libstdc++-v3/ChangeLog
libstdc++-v3/include/std/tuple
libstdc++-v3/include/tr1/tuple
libstdc++-v3/testsuite/20_util/tuple/comparison_operators/35480.cc [new file with mode: 0644]
libstdc++-v3/testsuite/tr1/6_containers/tuple/comparison_operators/35480.cc [new file with mode: 0644]

index b8f16da..58ed257 100644 (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-04  Joseph Myers  <joseph@codesourcery.com>
 
        * crossconfig.m4 (*-mingw32*): Define HAVE_STRTOF and
index b870234..78f69de 100644 (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));
     }
 
index ae6a36c..e4185e2 100644 (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));
     }
 
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 (file)
index 0000000..969fc65
--- /dev/null
@@ -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 (file)
index 0000000..effa3da
--- /dev/null
@@ -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" }