From 284844495422a295597af5b93cbd798e920f3c44 Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Wed, 15 Feb 2012 20:13:52 +0000 Subject: [PATCH] tuple was accidentally lacking a valid copy assignment operator. It went undetected because I had failed to test assigning from a const lvalue. This fixes http://llvm.org/bugs/show_bug.cgi?id=11921 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@150613 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/tuple | 8 ++++++++ .../tuple/tuple.tuple/tuple.assign/copy.pass.cpp | 2 +- .../utilities/tuple/tuple.tuple/tuple.cnstr/copy.pass.cpp | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/tuple b/include/tuple index d5c6ad0b..2bdb05fb 100644 --- a/include/tuple +++ b/include/tuple @@ -500,6 +500,14 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...> return *this; } + _LIBCPP_INLINE_VISIBILITY + __tuple_impl& + operator=(const __tuple_impl& __t) + { + __swallow(__tuple_leaf<_Indx, _Tp>::operator=(static_cast&>(__t).get())...); + return *this; + } + _LIBCPP_INLINE_VISIBILITY void swap(__tuple_impl& __t) _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) diff --git a/test/utilities/tuple/tuple.tuple/tuple.assign/copy.pass.cpp b/test/utilities/tuple/tuple.tuple/tuple.assign/copy.pass.cpp index 45a06aa4..f19043ca 100644 --- a/test/utilities/tuple/tuple.tuple/tuple.assign/copy.pass.cpp +++ b/test/utilities/tuple/tuple.tuple/tuple.assign/copy.pass.cpp @@ -42,7 +42,7 @@ int main() } { typedef std::tuple T; - T t0(2, 'a', "some text"); + const T t0(2, 'a', "some text"); T t; t = t0; assert(std::get<0>(t) == 2); diff --git a/test/utilities/tuple/tuple.tuple/tuple.cnstr/copy.pass.cpp b/test/utilities/tuple/tuple.tuple/tuple.cnstr/copy.pass.cpp index 0f0d1fb9..7de3ef61 100644 --- a/test/utilities/tuple/tuple.tuple/tuple.cnstr/copy.pass.cpp +++ b/test/utilities/tuple/tuple.tuple/tuple.cnstr/copy.pass.cpp @@ -39,7 +39,7 @@ int main() } { typedef std::tuple T; - T t0(2, 'a', "some text"); + const T t0(2, 'a', "some text"); T t = t0; assert(std::get<0>(t) == 2); assert(std::get<1>(t) == 'a');