From patchwork Wed Oct 19 19:35:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ville Voutilainen X-Patchwork-Id: 684309 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3szhxN3Y0bz9sD6 for ; Thu, 20 Oct 2016 06:35:34 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=Sb/X5lm6; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=pPPTdMxy+5V/Vq9N68/yMn7V3La5CmG2LbT2IwyWW4WnWh YrmvmETR0Gn2LCiHELjq4kE4IZ1DpVMQOFsROpp6v4bRUXMdvewsLaIvnpvev19l 2tF9E+xHY/BcTLJTVZU9p0btwANayb4EV8HTVSKMYYHqQrTOUYbxF5n75mFow= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=hBtQ+RgDC7XpDwWiJQf8UibCZo0=; b=Sb/X5lm6cYGKeGZwVz29 M0yinNjPQG2WkmF1nOFEbNODRDfYCrQrBfoPfuz23/z1VaMXoYbSPxSWg8266Qjg /XJ5Zi+0aq7DuWDb6Ge1IZ8pLJo3Q897jumThAo6CwnsyahS3ANBqHSFRmzgNIyU YceX5J1dZaMx0n5zAX6uqgg= Received: (qmail 62299 invoked by alias); 19 Oct 2016 19:35:20 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 62274 invoked by uid 89); 19 Oct 2016 19:35:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=no version=3.3.2 spammy=Hx-languages-length:2550 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-it0-f52.google.com Received: from mail-it0-f52.google.com (HELO mail-it0-f52.google.com) (209.85.214.52) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 19 Oct 2016 19:35:17 +0000 Received: by mail-it0-f52.google.com with SMTP id 139so115980122itm.1; Wed, 19 Oct 2016 12:35:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=z40pRbBeukgZ3WX/jtLW0/Mn6+qW//w+BzlpTsp8TYU=; b=e1t/PF1/26tOGXQDLqGZtkDnjWfI/ue8D62wJSYnxSn8khcHOditXJWVtKbSqUMn93 69Gu6t0s4GuppWnhUgHKJqckVX01rGtgYJ6r4PNwXmDtgPaM1BKf1VPIkxsdOt8GcKaR 2sO0CtU8/sGcwnpwsqYRWIqECUBa2PLTkPlGRd2GjFutfrz6zUkbJy6wvPqZKE5LYHNK GQOQkct8E1RLvqPZ+r391EhAVtyzUUZQAvoej6R2rCGU6/CX1Rr2KUnGPJrR4ZaDEr/X DttrEaS1f41+Qav+ZsLqxGTa+lyid8vhXqx7Cnr333WU4lpX0UqjL5aN2fqjz+r6vQLm NPAg== X-Gm-Message-State: AA6/9Rmm/hDFU1q70f004QGMHmpD/2bKIzRlL4mEK3zy2t4eV0qJgzecEaEbuFB6PYUouYx8DmWqW4yiRUh6OA== X-Received: by 10.36.213.131 with SMTP id a125mr7682048itg.14.1476905715304; Wed, 19 Oct 2016 12:35:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.28.200 with HTTP; Wed, 19 Oct 2016 12:35:14 -0700 (PDT) From: Ville Voutilainen Date: Wed, 19 Oct 2016 22:35:14 +0300 Message-ID: Subject: [v3 PATCH] Do the operator= SFINAE in the return type for optional, not in the template parameters. To: "libstdc++" , "gcc-patches@gcc.gnu.org" Tested on Linux-x64. 2016-10-19 Ville Voutilainen Do the operator= SFINAE in the return type for optional, not in the template parameters. * include/std/optional (operator=(_Up&&)): Move SFINAE from template parameters to the return type. (operator=(const optional<_Up>&)): Likewise. (operator=(optional<_Up>&&)): Likewise. diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional index 21210ab..f272876 100644 --- a/libstdc++-v3/include/std/optional +++ b/libstdc++-v3/include/std/optional @@ -568,15 +568,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return *this; } - template, decay_t<_Up>>>, - is_constructible<_Tp, _Up>, - __not_<__and_, - is_same<_Tp, decay_t<_Up>>>>, - is_assignable<_Tp&, _Up>>::value, - bool> = true> - optional& + template + enable_if_t<__and_< + __not_, decay_t<_Up>>>, + is_constructible<_Tp, _Up>, + __not_<__and_, + is_same<_Tp, decay_t<_Up>>>>, + is_assignable<_Tp&, _Up>>::value, + optional&> operator=(_Up&& __u) { if (this->_M_is_engaged()) @@ -587,16 +586,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return *this; } - template>, - is_constructible<_Tp, const _Up&>, - is_assignable<_Tp&, _Up>, - __not_<__converts_from_optional<_Tp, _Up>>, - __not_<__assigns_from_optional<_Tp, _Up>> - >::value, - bool> = true> - optional& + template + enable_if_t<__and_< + __not_>, + is_constructible<_Tp, const _Up&>, + is_assignable<_Tp&, _Up>, + __not_<__converts_from_optional<_Tp, _Up>>, + __not_<__assigns_from_optional<_Tp, _Up>> + >::value, + optional&> operator=(const optional<_Up>& __u) { if (__u) @@ -613,16 +611,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return *this; } - template>, - is_constructible<_Tp, _Up>, - is_assignable<_Tp&, _Up>, - __not_<__converts_from_optional<_Tp, _Up>>, - __not_<__assigns_from_optional<_Tp, _Up>> - >::value, - bool> = true> - optional& + template + enable_if_t<__and_< + __not_>, + is_constructible<_Tp, _Up>, + is_assignable<_Tp&, _Up>, + __not_<__converts_from_optional<_Tp, _Up>>, + __not_<__assigns_from_optional<_Tp, _Up>> + >::value, + optional&> operator=(optional<_Up>&& __u) { if (__u)