From patchwork Fri Jul 6 10:20:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 940370 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-481109-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="xvmsMDA8"; dkim-atps=neutral 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 41MW2j6ffvz9s29 for ; Fri, 6 Jul 2018 20:20:44 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=vy8r/nPFRDvV8ozxUE6gkH8iJoncm2uUn/7BD6dmS9uKtQWNFrrs5 yC6TRln/u1w5guI69oxEaecdoWB/Y1oPc/P5SzeiOYCqejiYrOfZnmj0qiB6MrFO b+69E0wxkCEtLBzHRPDqziI0mIKMyqp7lHQwO9fNBJUvBktpWKgB0s= 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:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=orZDkala1L6ClsIG6+LQNHSFYXI=; b=xvmsMDA8V6z0FDxR++K0 ARKQASv5r54YVNAxJGCBB2G+LTua/nYxOzaEjvDweT9u8ErDCSePNck05Gxd99FW K9CCHShnlYEMjvulTCU6azRbHTIn2+YBVnJjOO3j7ziyoImzEDrJuuF20kXHJB5o UucdKndcj8TlBSdA7iWPwZo= Received: (qmail 4664 invoked by alias); 6 Jul 2018 10:20:37 -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 4642 invoked by uid 89); 6 Jul 2018 10:20:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1313 X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Jul 2018 10:20:34 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 205AE34673; Fri, 6 Jul 2018 10:20:33 +0000 (UTC) Received: from localhost (unknown [10.33.36.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id CBB647C44; Fri, 6 Jul 2018 10:20:32 +0000 (UTC) Date: Fri, 6 Jul 2018 11:20:32 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH] include/std/variant (__accepted_index): Use void_t. Message-ID: <20180706102032.GA25775@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.9.2 (2017-12-15) Tested powerpc64le-linux, committed to trunk. commit d66ad3c7feea986bfb95543e07b7063931d97e96 Author: Jonathan Wakely Date: Fri Jul 6 09:58:12 2018 +0100 * include/std/variant (__accepted_index): Use void_t. diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant index 63eafdd58e5..66d878142a4 100644 --- a/libstdc++-v3/include/std/variant +++ b/libstdc++-v3/include/std/variant @@ -710,7 +710,8 @@ namespace __variant }; // Helper for variant(_Tp&&) and variant::operator=(_Tp&&). - // __accepted_index maps the arbitrary _Tp to an alternative type in _Variant. + // __accepted_index maps an arbitrary _Tp to an alternative type in _Variant + // (or to variant_npos). template struct __accepted_index { static constexpr size_t value = variant_npos; }; @@ -718,8 +719,7 @@ namespace __variant template struct __accepted_index< _Tp, variant<_Types...>, - decltype(__overload_set<_Types...>::_S_fun(std::declval<_Tp>()), - std::declval())> + void_t::_S_fun(std::declval<_Tp>()))>> { static constexpr size_t value = sizeof...(_Types) - 1 - decltype(__overload_set<_Types...>::