2015-10-05 Ville Voutilainen <ville.voutilainen@gmail.com>
authorville <ville@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 5 Oct 2015 09:57:20 +0000 (09:57 +0000)
committerville <ville@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 5 Oct 2015 09:57:20 +0000 (09:57 +0000)
PR 67844.
* include/std/tuple (_TC::_NonNestedTuple): Eagerly reject
conversions from tuple types same as the target tuple.
* testsuite/20_util/tuple/67844.cc: New.
* testsuite/20_util/tuple/cons/nested_tuple_construct.cc: Add
a missing copyright header.

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

libstdc++-v3/ChangeLog
libstdc++-v3/include/std/tuple
libstdc++-v3/testsuite/20_util/tuple/67844.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/tuple/cons/nested_tuple_construct.cc

index fa18ece..e293439 100644 (file)
@@ -1,3 +1,12 @@
+2015-10-05  Ville Voutilainen  <ville.voutilainen@gmail.com>
+
+       PR 67844.
+       * include/std/tuple (_TC::_NonNestedTuple): Eagerly reject
+       conversions from tuple types same as the target tuple.
+       * testsuite/20_util/tuple/67844.cc: New.
+       * testsuite/20_util/tuple/cons/nested_tuple_construct.cc: Add
+       a missing copyright header.
+
 2015-10-03  Jonathan Wakely  <jwakely@redhat.com>
 
        * python/libstdcxx/v6/printers.py (StdExpAnyPrinter): Remove support
index 751d7eb..8af01f4 100644 (file)
@@ -457,6 +457,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       }
     };
 
+  template<typename... _Elements>
+    class tuple;
 
   // Concept utility functions, reused in conditionally-explicit
   // constructors.
@@ -490,7 +492,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     template<typename _SrcTuple>
     static constexpr bool _NonNestedTuple()
     {
-      return  __and_<__not_<is_convertible<_SrcTuple, _Elements...>>,
+      return  __and_<__not_<is_same<tuple<_Elements...>,
+                                   typename remove_cv<
+                                     typename remove_reference<_SrcTuple>::type
+                                   >::type>>,
+                     __not_<is_convertible<_SrcTuple, _Elements...>>,
                      __not_<is_constructible<_Elements..., _SrcTuple>>
               >::value;
     }
diff --git a/libstdc++-v3/testsuite/20_util/tuple/67844.cc b/libstdc++-v3/testsuite/20_util/tuple/67844.cc
new file mode 100644 (file)
index 0000000..a4efb5a
--- /dev/null
@@ -0,0 +1,43 @@
+// { dg-do compile }
+
+// Copyright (C) 2015 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// libstdc++/67844
+
+#include <tuple>
+
+struct A
+{
+  template <typename T>
+  A(T)
+  {
+  }
+
+  A(const A&) = default;
+  A(A&&) = default;
+  A& operator=(const A&) = default;
+  A& operator=(A&&) = default;
+  ~A() = default;
+};
+
+int main()
+{
+  auto x = A{7};
+  std::make_tuple(x);
+}
+
index 32ef3cc..6085bee 100644 (file)
@@ -1,3 +1,20 @@
+// Copyright (C) 2015 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
 #include <string>
 #include <tuple>
 #include <testsuite_hooks.h>