summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2014-07-29 17:30:34 +0000
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2014-07-29 17:30:34 +0000
commitc57b5e50265145c7fbc3afd4c1fee3b5bd12a3f9 (patch)
tree3dc5cddfd2fcd2996793d023583ac2471255a6db /libstdc++-v3
parentea8ab4079184cf5c448a0f87b9a5e6a83f088933 (diff)
downloadgcc-c57b5e50265145c7fbc3afd4c1fee3b5bd12a3f9.tar.gz
PR libstdc++/61947
* include/std/tuple (_Head_base): Use allocator_arg_t parameters to disambiguate unary constructors. (_Tuple_impl): Pass allocator_arg_t arguments. * testsuite/20_util/tuple/61947.cc: New. * testsuite/20_util/uses_allocator/cons_neg.cc: Adjust dg-error line. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@213221 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog7
-rw-r--r--libstdc++-v3/include/std/tuple28
-rw-r--r--libstdc++-v3/testsuite/20_util/tuple/61947.cc29
-rw-r--r--libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc2
4 files changed, 52 insertions, 14 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 42cfa7bcf52..76b663c5c07 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -6,6 +6,13 @@
_S_new_RopeFunction.
* testsuite/ext/rope/61946.cc: New.
+ PR libstdc++/61947
+ * include/std/tuple (_Head_base): Use allocator_arg_t parameters to
+ disambiguate unary constructors.
+ (_Tuple_impl): Pass allocator_arg_t arguments.
+ * testsuite/20_util/tuple/61947.cc: New.
+ * testsuite/20_util/uses_allocator/cons_neg.cc: Adjust dg-error line.
+
2014-07-29 Ed Smith-Rowland <3dw4rd@verizon.net>
PR libstdc++/60037 - SIGFPE in std::generate_canonical<unsigned int...>
diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index ef8aa5ab6f4..6c1032fb46c 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -61,21 +61,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr _Head_base(const _Head& __h)
: _Head(__h) { }
- template<typename _UHead, typename = typename
- enable_if<!is_convertible<_UHead,
- __uses_alloc_base>::value>::type>
+ constexpr _Head_base(const _Head_base&) = default;
+ constexpr _Head_base(_Head_base&&) = default;
+
+ template<typename _UHead>
constexpr _Head_base(_UHead&& __h)
: _Head(std::forward<_UHead>(__h)) { }
- _Head_base(__uses_alloc0)
+ _Head_base(allocator_arg_t, __uses_alloc0)
: _Head() { }
template<typename _Alloc>
- _Head_base(__uses_alloc1<_Alloc> __a)
+ _Head_base(allocator_arg_t, __uses_alloc1<_Alloc> __a)
: _Head(allocator_arg, *__a._M_a) { }
template<typename _Alloc>
- _Head_base(__uses_alloc2<_Alloc> __a)
+ _Head_base(allocator_arg_t, __uses_alloc2<_Alloc> __a)
: _Head(*__a._M_a) { }
template<typename _UHead>
@@ -106,21 +107,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr _Head_base(const _Head& __h)
: _M_head_impl(__h) { }
- template<typename _UHead, typename = typename
- enable_if<!is_convertible<_UHead,
- __uses_alloc_base>::value>::type>
+ constexpr _Head_base(const _Head_base&) = default;
+ constexpr _Head_base(_Head_base&&) = default;
+
+ template<typename _UHead>
constexpr _Head_base(_UHead&& __h)
: _M_head_impl(std::forward<_UHead>(__h)) { }
- _Head_base(__uses_alloc0)
+ _Head_base(allocator_arg_t, __uses_alloc0)
: _M_head_impl() { }
template<typename _Alloc>
- _Head_base(__uses_alloc1<_Alloc> __a)
+ _Head_base(allocator_arg_t, __uses_alloc1<_Alloc> __a)
: _M_head_impl(allocator_arg, *__a._M_a) { }
template<typename _Alloc>
- _Head_base(__uses_alloc2<_Alloc> __a)
+ _Head_base(allocator_arg_t, __uses_alloc2<_Alloc> __a)
: _M_head_impl(*__a._M_a) { }
template<typename _UHead>
@@ -258,7 +260,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Alloc>
_Tuple_impl(allocator_arg_t __tag, const _Alloc& __a)
: _Inherited(__tag, __a),
- _Base(__use_alloc<_Head>(__a)) { }
+ _Base(__tag, __use_alloc<_Head>(__a)) { }
template<typename _Alloc>
_Tuple_impl(allocator_arg_t __tag, const _Alloc& __a,
diff --git a/libstdc++-v3/testsuite/20_util/tuple/61947.cc b/libstdc++-v3/testsuite/20_util/tuple/61947.cc
new file mode 100644
index 00000000000..7e77de657a1
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/tuple/61947.cc
@@ -0,0 +1,29 @@
+// { dg-options "-std=gnu++11" }
+// { dg-do compile }
+
+// Copyright (C) 2014 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 <tuple>
+
+struct ConvertibleToAny {
+ template <class T> operator T() const { return T(); }
+};
+
+int main() {
+ std::tuple<ConvertibleToAny&&> t(ConvertibleToAny{});
+}
diff --git a/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc b/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc
index cf5d6a57dd9..6396e2678ec 100644
--- a/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc
@@ -44,4 +44,4 @@ void test01()
tuple<Type> t(allocator_arg, a, 1);
}
-// { dg-error "no matching function" "" { target *-*-* } 91 }
+// { dg-error "no matching function" "" { target *-*-* } 92 }