On Apr 3, 2012, at 5:52 PM, Eli Friedman wrote: > On Tue, Apr 3, 2012 at 2:09 PM, Howard Hinnant <[email protected]> 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
Agreed. I have not yet built a constexpr enabled clang. Once I do I will investigate the best way to handle this. Howard _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
