From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by sourceware.org (Postfix) with ESMTP id 7FE66385B835 for ; Thu, 9 Apr 2020 07:55:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7FE66385B835 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-147-NQLR4VkMPbixyXl8wdkv6Q-1; Thu, 09 Apr 2020 03:55:10 -0400 X-MC-Unique: NQLR4VkMPbixyXl8wdkv6Q-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4DE6E1005509; Thu, 9 Apr 2020 07:55:09 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C8F915C545; Thu, 9 Apr 2020 07:55:08 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id 0397t6it026366; Thu, 9 Apr 2020 09:55:06 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id 0397t3kX026365; Thu, 9 Apr 2020 09:55:03 +0200 Date: Thu, 9 Apr 2020 09:55:03 +0200 From: Jakub Jelinek To: Martin =?utf-8?B?TGnFoWth?= Cc: Richard Biener , Jason Merrill , Jonathan Wakely , Jan Hubicka , GCC Patches , Marc Glisse , Nathan Sidwell Subject: Re: [PATCH] Allow new/delete operator deletion only for replaceable. Message-ID: <20200409075503.GM2212@tucnak> Reply-To: Jakub Jelinek References: <20200408133252.GG2212@tucnak> <20d175a6-23df-43e5-7027-d11fc660abd1@suse.cz> <150a514d-f460-78de-fd53-43c3eb2f6d4c@suse.cz> MIME-Version: 1.0 In-Reply-To: <150a514d-f460-78de-fd53-43c3eb2f6d4c@suse.cz> User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_DNSWL_NONE, 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: Thu, 09 Apr 2020 07:55:16 -0000 On Thu, Apr 09, 2020 at 08:59:59AM +0200, Martin Li=C5=A1ka wrote: > What do you mean by 'decl flags'. We can't compare ASM names as one is ct= or > and the second one is dtor. It's about argument types that much match, ri= ght? You can't disginguish the [] vs. non-[] from arguments, plus there are some changes in the arguments in all cases anyway (e.g. first argument of operator delete always being the pointer, while first argument of operator new being size_t, but some operator delete forms also having size_t after it). See http://eel.is/c++draft/new.delete=20 [[nodiscard]] void* operator new(std::size_t size); [[nodiscard]] void* operator new(std::size_t size, std::align_val_t alignme= nt); [[nodiscard]] void* operator new(std::size_t size, const std::nothrow_t&) n= oexcept; [[nodiscard]] void* operator new(std::size_t size, std::align_val_t alignme= nt, const std::nothrow_t&) noexcept; void operator delete(void* ptr) noexcept; void operator delete(void* ptr, std::size_t size) noexcept; void operator delete(void* ptr, std::align_val_t alignment) noexcept; void operator delete(void* ptr, std::size_t size, std::align_val_t alignmen= t) noexcept; void operator delete(void* ptr, const std::nothrow_t&) noexcept; void operator delete(void* ptr, std::align_val_t alignment, const std::noth= row_t&) noexcept; [[nodiscard]] void* operator new[](std::size_t size); [[nodiscard]] void* operator new[](std::size_t size, std::align_val_t align= ment); [[nodiscard]] void* operator new[](std::size_t size, const std::nothrow_t&)= noexcept; [[nodiscard]] void* operator new[](std::size_t size, std::align_val_t align= ment, const std::nothrow_t&) noexcept; void operator delete[](void* ptr) noexcept; void operator delete[](void* ptr, std::size_t size) noexcept; void operator delete[](void* ptr, std::align_val_t alignment) noexcept; void operator delete[](void* ptr, std::size_t size, std::align_val_t alignm= ent) noexcept; void operator delete[](void* ptr, const std::nothrow_t&) noexcept; void operator delete[](void* ptr, std::align_val_t alignment, const std::no= throw_t&) noexcept; I believe one can't allocate with operator new and free with operator delet= e[] or allocate with operator new[] and free with operator delete, but am not sure if there aren't other requirements? E.g. "If the alignment parameter is not present, ptr was returned by an all= ocation function without an alignment parameter. If present, the alignment argument is equa= l to the alignment argument passed to the allocation function that returned ptr." suggests one can't mix the std::align_val_t vs. non-std::align_val_t cases, dunno about the throwing vs. non-throwing or sizd ones. =09Jakub