From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by sourceware.org (Postfix) with ESMTP id D633F3858D35 for ; Fri, 31 Jul 2020 20:28:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D633F3858D35 Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-292-6_jBqxI7Of-BeYJOkJyLeA-1; Fri, 31 Jul 2020 16:28:09 -0400 X-MC-Unique: 6_jBqxI7Of-BeYJOkJyLeA-1 Received: by mail-qk1-f200.google.com with SMTP id g4so11572581qki.8 for ; Fri, 31 Jul 2020 13:28:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=xkrf5pOL+eiDtrSFVnrrc1zZxVNRY5YLHcLg5dmCCPc=; b=ZwSU1AdWDxuYYo5LeSk9lRJ38HFno5Q9mikS7HUBWOdc1x0iPPDjRtZq3Y2BgFBp0B HKohzQUCBDDviO9oUKhcSfhWxfQAgX8MeLEosba4VpL+SAv8dvSmK1MGTbjzVvzsw0je juZGhOWuD013QMX5nsXrisVzfiJOqcwdRF1VORmfykRdtV1UNgQOvVm4/XCGhSgtM3Mj uVarMfC/1W2MOeS6YwmDQG6bBO9rc9AaBvhzShhSlIAYvAIfsKVMcuQ0PWsKgMsykZO1 ewsDrnS//Xezk+snhjpTTKi44P7YbSUPaz1t3LfuTTADzo6wVo23ImJsBMR6f0dF3juZ tdKA== X-Gm-Message-State: AOAM531Ikdeq0Jk+JU64RXQlWuwItZ74XUQtJkNSQt3MC/PyGTdB7prl D9HnugDILyM3iBtnyMMVc82otgmwlRMtEbNfuVx8BXeKAyJWbyCecXw3AHHtBBFfiD0N3RrCj6J wuU77jAOKVrNH6BMpbg== X-Received: by 2002:a37:de15:: with SMTP id h21mr5600839qkj.77.1596227288432; Fri, 31 Jul 2020 13:28:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyn2yFNPZhChHnnz1mKTKKtRvC1AWri3A/GSNcEXvgZGDiRRligF8UmkZktrXmWAsbIAE1C1w== X-Received: by 2002:a37:de15:: with SMTP id h21mr5600826qkj.77.1596227288108; Fri, 31 Jul 2020 13:28:08 -0700 (PDT) Received: from [192.168.1.148] (209-6-216-142.s141.c3-0.smr-cbr1.sbo-smr.ma.cable.rcncustomer.com. [209.6.216.142]) by smtp.gmail.com with ESMTPSA id s30sm10453949qtc.87.2020.07.31.13.28.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 31 Jul 2020 13:28:07 -0700 (PDT) Subject: Re: [PATCH] c++: Add __builtin_bit_cast to implement std::bit_cast [PR93121] To: Jakub Jelinek , Jonathan Wakely Cc: gcc-patches@gcc.gnu.org References: <20200718185056.GN2363@tucnak> <0dda7918-cc7f-3f3f-64c0-34896ef9e15d@redhat.com> <20200730145732.GZ2363@tucnak> <20200731081911.GE2363@tucnak> <20200731095446.GU3400@redhat.com> <20200731100625.GF2363@tucnak> From: Jason Merrill Message-ID: <4f2a1527-f7f3-37e9-1d56-4794f9ede49b@redhat.com> Date: Fri, 31 Jul 2020 16:28:05 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200731100625.GF2363@tucnak> Content-Language: en-US X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2020 20:28:17 -0000 On 7/31/20 6:06 AM, Jakub Jelinek wrote: > On Fri, Jul 31, 2020 at 10:54:46AM +0100, Jonathan Wakely wrote: >>> Does the standard require that somewhere? Because that is not what the >>> compiler implements right now. >> >> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78620 > > But does that imply that all CONSTRUCTORs without CONSTRUCTOR_NO_CLEARING > need to be treated that way? I mean, aren't such CONSTRUCTORs used also for > other initializations? Yes, they are also used to represent constant values of classes that are initialized by constexpr constructor. > And, are the default copy constructors or assignment operators supposed to > also copy the padding bits, or do they become unspecified again through > that? For a non-union class, a defaulted copy is defined as memberwise copy, not a copy of the entire object representation. So I guess strictly speaking the padding bits do become unspecified. But I think if the copy is trivial, in practice all implementations do copy the object representation; perhaps the specification should adjust accordingly. Jason