From owner-svn-src-stable@freebsd.org Fri Mar 24 18:28:15 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 134DED1B5F4; Fri, 24 Mar 2017 18:28:15 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E1FA51288; Fri, 24 Mar 2017 18:28:14 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2OISEJE035755; Fri, 24 Mar 2017 18:28:14 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2OISEJm035754; Fri, 24 Mar 2017 18:28:14 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201703241828.v2OISEJm035754@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 24 Mar 2017 18:28:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r315915 - in stable: 10/contrib/libc++/include 9/contrib/libc++/include X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Mar 2017 18:28:15 -0000 Author: dim Date: Fri Mar 24 18:28:13 2017 New Revision: 315915 URL: https://svnweb.freebsd.org/changeset/base/315915 Log: Pull in r283944 from upstream libc++ trunk (by Eric Fiselier): Fix std::pair on FreeBSD Summary: FreeBSD ships an old ABI for std::pair which requires that it have non-trivial copy/move constructors. Currently the non-trivial copy/move is achieved by providing explicit definitions of the constructors. This is problematic because it means the constructors don't SFINAE properly. In order to SFINAE copy/move constructors they have to be explicitly defaulted and hense non-trivial. This patch attempts to provide SFINAE'ing copy/move constructors for std::pair while still making them non-trivial. It does this by adding a base class with a non-trivial copy constructor and then allowing pair's constructors to be generated by the compiler. This also allows the constructors to be constexpr. Reviewers: emaste, theraven, rsmith, dim Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25389 This should fix building www/chromium 57.0.2987.110 on stable/10 and stable/9 without having to use -D_LIBCPP_TRIVIAL_PAIR_COPY_CTOR=1 (which changes the ABI). Direct commit to stable/10 and stable/9, since head already has libc++ 4.0, which includes this fix. Modified: stable/9/contrib/libc++/include/utility Changes in other areas also in this revision: Modified: stable/10/contrib/libc++/include/utility Modified: stable/9/contrib/libc++/include/utility ============================================================================== --- stable/9/contrib/libc++/include/utility Fri Mar 24 17:34:55 2017 (r315914) +++ stable/9/contrib/libc++/include/utility Fri Mar 24 18:28:13 2017 (r315915) @@ -244,8 +244,20 @@ extern const piecewise_construct_t piece constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t(); #endif +#if !_LIBCPP_TRIVIAL_PAIR_COPY_CTOR +struct __non_trivially_copyable_base { + _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY + __non_trivially_copyable_base() _NOEXCEPT {} + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + __non_trivially_copyable_base(__non_trivially_copyable_base const&) _NOEXCEPT {} +}; +#endif + template struct _LIBCPP_TYPE_VIS_ONLY pair +#if !_LIBCPP_TRIVIAL_PAIR_COPY_CTOR +: private __non_trivially_copyable_base +#endif { typedef _T1 first_type; typedef _T2 second_type; @@ -253,9 +265,6 @@ struct _LIBCPP_TYPE_VIS_ONLY pair _T1 first; _T2 second; - // pair(const pair&) = default; - // pair(pair&&) = default; - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR pair() : first(), second() {} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 @@ -272,18 +281,11 @@ struct _LIBCPP_TYPE_VIS_ONLY pair ) : first(__p.first), second(__p.second) {} -#if !defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && _LIBCPP_TRIVIAL_PAIR_COPY_CTOR - _LIBCPP_INLINE_VISIBILITY - pair(const pair& __p) = default; -#elif !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) || !_LIBCPP_TRIVIAL_PAIR_COPY_CTOR - _LIBCPP_INLINE_VISIBILITY - pair(const pair& __p) - _NOEXCEPT_(is_nothrow_copy_constructible::value && - is_nothrow_copy_constructible::value) - : first(__p.first), - second(__p.second) - { - } +#if !defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) + pair(pair const&) = default; + pair(pair&&) = default; +#else + // Use the implicitly declared copy constructor in C++03 #endif _LIBCPP_INLINE_VISIBILITY @@ -315,19 +317,6 @@ struct _LIBCPP_TYPE_VIS_ONLY pair : first(_VSTD::forward<_U1>(__p.first)), second(_VSTD::forward<_U2>(__p.second)) {} -#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS - _LIBCPP_INLINE_VISIBILITY - pair(pair&& __p) = default; -#else - _LIBCPP_INLINE_VISIBILITY - pair(pair&& __p) _NOEXCEPT_(is_nothrow_move_constructible::value && - is_nothrow_move_constructible::value) - : first(_VSTD::forward(__p.first)), - second(_VSTD::forward(__p.second)) - { - } -#endif - _LIBCPP_INLINE_VISIBILITY pair& operator=(pair&& __p) _NOEXCEPT_(is_nothrow_move_assignable::value &&