Libc++ - Add constexpr to std::move and std::forward (post C++11)

Howard Hinnant howard.hinnant at gmail.com
Mon Jul 15 13:05:44 PDT 2013


On Jul 15, 2013, at 11:42 AM, Marshall Clow <mclow.lists at gmail.com> wrote:

> This is the first step towards fixing http://llvm.org/bugs/show_bug.cgi?id=16599

Thanks much Marshall!

Marshall and I have been talking privately about this patch.  For everyone else, we've agreed to it with a couple of minor changes:

1.  We need to document the added constexpr for forward, move and move_if_noexcept.  All of this documentation will go in the <utility> synopsis.  I'm not sure exactly how it will look, but I have every confidence that Marshall will make it clear.

2.  During testing we uncovered a latent bug in the new get<type>(tuple&&) function which we'll fix with the same commit:

Index: include/tuple
===================================================================
--- include/tuple	(revision 186334)
+++ include/tuple	(working copy)
@@ -843,7 +843,7 @@
 inline _LIBCPP_INLINE_VISIBILITY
 constexpr _T1&& get(tuple<_Args...>&& __tup) noexcept
 {
-    return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(_VSTD::move<tuple<_Args...>>(__tup));
+    return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(_VSTD::move(__tup));
 }
 
 #endif

Thanks,
Howard





More information about the cfe-commits mailing list