[cfe-commits] [libcxx] r153968 - in /libcxx/trunk: include/utility src/utility.cpp
Eli Friedman
eli.friedman at gmail.com
Tue Apr 3 14:52:05 PDT 2012
On Tue, Apr 3, 2012 at 2:09 PM, Howard Hinnant <hhinnant at apple.com> wrote:
> 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
This seems dangerous: we don't want the ABI of libc++ to depend on
_LIBCPP_HAS_NO_CONSTEXPR.
-Eli
More information about the cfe-commits
mailing list