[cfe-commits] [libcxx] r150613 - in /libcxx/trunk: include/tuple test/utilities/tuple/tuple.tuple/tuple.assign/copy.pass.cpp test/utilities/tuple/tuple.tuple/tuple.cnstr/copy.pass.cpp

Howard Hinnant hhinnant at apple.com
Wed Feb 15 12:13:52 PST 2012


Author: hhinnant
Date: Wed Feb 15 14:13:52 2012
New Revision: 150613

URL: http://llvm.org/viewvc/llvm-project?rev=150613&view=rev
Log:
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

Modified:
    libcxx/trunk/include/tuple
    libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.assign/copy.pass.cpp
    libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.cnstr/copy.pass.cpp

Modified: libcxx/trunk/include/tuple
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/tuple?rev=150613&r1=150612&r2=150613&view=diff
==============================================================================
--- libcxx/trunk/include/tuple (original)
+++ libcxx/trunk/include/tuple Wed Feb 15 14:13:52 2012
@@ -500,6 +500,14 @@
             return *this;
         }
 
+        _LIBCPP_INLINE_VISIBILITY
+        __tuple_impl&
+        operator=(const __tuple_impl& __t)
+        {
+            __swallow(__tuple_leaf<_Indx, _Tp>::operator=(static_cast<const __tuple_leaf<_Indx, _Tp>&>(__t).get())...);
+            return *this;
+        }
+
     _LIBCPP_INLINE_VISIBILITY
     void swap(__tuple_impl& __t)
         _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value)

Modified: libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.assign/copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.assign/copy.pass.cpp?rev=150613&r1=150612&r2=150613&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.assign/copy.pass.cpp (original)
+++ libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.assign/copy.pass.cpp Wed Feb 15 14:13:52 2012
@@ -42,7 +42,7 @@
     }
     {
         typedef std::tuple<int, char, std::string> T;
-        T t0(2, 'a', "some text");
+        const T t0(2, 'a', "some text");
         T t;
         t = t0;
         assert(std::get<0>(t) == 2);

Modified: libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.cnstr/copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.cnstr/copy.pass.cpp?rev=150613&r1=150612&r2=150613&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.cnstr/copy.pass.cpp (original)
+++ libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.cnstr/copy.pass.cpp Wed Feb 15 14:13:52 2012
@@ -39,7 +39,7 @@
     }
     {
         typedef std::tuple<int, char, std::string> 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');





More information about the cfe-commits mailing list