From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 57159 invoked by alias); 1 Dec 2016 11:16:21 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 57140 invoked by uid 89); 1 Dec 2016 11:16:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.8 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*f:YUzzZz, H*i:3YKMo5rm, H*i:YUzzZz, H*f:sk:UuPjPBQ X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 01 Dec 2016 11:16:17 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D04C361980; Thu, 1 Dec 2016 11:16:16 +0000 (UTC) Received: from localhost (ovpn-116-53.ams2.redhat.com [10.36.116.53]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uB1BGGpN008804; Thu, 1 Dec 2016 06:16:16 -0500 Date: Thu, 01 Dec 2016 11:16:00 -0000 From: Jonathan Wakely To: Tim Shen Cc: libstdc++ , gcc-patches Subject: Re: [Patches] Add variant constexpr support for visit, comparisons and get Message-ID: <20161201111615.GC3301@redhat.com> References: <20161130162729.GU3301@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.7.1 (2016-10-04) X-SW-Source: 2016-12/txt/msg00043.txt.bz2 On 30/11/16 19:29 -0800, Tim Shen wrote: >On Wed, Nov 30, 2016 at 8:27 AM, Jonathan Wakely wrote: >> On 26/11/16 21:38 -0800, Tim Shen wrote: >>> + template> >>> struct _Uninitialized; >> >> >> I'm still unsure that is_literal_type is the right trait here. If it's >> definitely right then we should probably *not* deprecate it in C++17! > >No it's not right. We need this only because [basic.types]p10.5.3 (in n4606): > > if it (a literal type) is a union, at least one of its non-static >data members is of non-volatile literal type, ... > >is not implemented. In the current GCC implementation, however, all >non-static data members need to be literal types, in order to create a >literal union. > >With the current GCC implementation, to keep our goal, which is to >make _Variadic_union literal type, we need to ensure that >_Uninitialized is literal type, by specializing on T: >1) If is_literal_type_v, store a T; >2) otherwise, store a raw buffer of T. > >In the future, when [basic.types]p10.5.3 is implemented, we don't need >is_literal_type_v. > >I'll add a comment here. Thanks, that will stop me asking again and again in future ;-) I think we want to get [basic.types] p10 implemented before we declare C++17 support non-experimental, so we don't have to change std::variant layout later. >I didn't check for other compilers. That's fine, the current approach should work for them too.