[cfe-commits] [libcxx] r153968 - in /libcxx/trunk: include/utility src/utility.cpp

Howard Hinnant hhinnant at apple.com
Tue Apr 3 14:09:48 PDT 2012


Author: hhinnant
Date: Tue Apr  3 16:09:48 2012
New Revision: 153968

URL: http://llvm.org/viewvc/llvm-project?rev=153968&view=rev
Log:
constexpr support for <utility>.  Patch contributed by Jonathan Sauer.

Modified:
    libcxx/trunk/include/utility
    libcxx/trunk/src/utility.cpp

Modified: libcxx/trunk/include/utility
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/utility?rev=153968&r1=153967&r2=153968&view=diff
==============================================================================
--- libcxx/trunk/include/utility (original)
+++ libcxx/trunk/include/utility Tue Apr  3 16:09:48 2012
@@ -206,8 +206,11 @@
 }
 
 struct _LIBCPP_VISIBLE piecewise_construct_t { };
-//constexpr
+#ifdef _LIBCPP_HAS_NO_CONSTEXPR
 extern const piecewise_construct_t piecewise_construct;// = piecewise_construct_t();
+#else
+constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
+#endif
 
 template <class _T1, class _T2>
 struct _LIBCPP_VISIBLE pair
@@ -221,7 +224,7 @@
     // pair(const pair&) = default;
     // pair(pair&&) = default;
 
-    _LIBCPP_INLINE_VISIBILITY pair() : first(), second() {}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR pair() : first(), second() {}
 
     _LIBCPP_INLINE_VISIBILITY pair(const _T1& __x, const _T2& __y)
         : first(__x), second(__y) {}

Modified: libcxx/trunk/src/utility.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/utility.cpp?rev=153968&r1=153967&r2=153968&view=diff
==============================================================================
--- libcxx/trunk/src/utility.cpp (original)
+++ libcxx/trunk/src/utility.cpp Tue Apr  3 16:09:48 2012
@@ -11,6 +11,8 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+#ifdef _LIBCPP_HAS_NO_CONSTEXPR
 const piecewise_construct_t piecewise_construct = {};
+#endif
 
 _LIBCPP_END_NAMESPACE_STD





More information about the cfe-commits mailing list