From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by sourceware.org (Postfix) with ESMTPS id A4B08385C019 for ; Tue, 7 Apr 2020 11:30:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A4B08385C019 Received: by mail-io1-xd43.google.com with SMTP id s15so2965187ioj.7 for ; Tue, 07 Apr 2020 04:30:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=x1RtA/EJ/UsljOtFxBkXKW/YJJefE411onAaxs29VbM=; b=cn0zTZVhqL/Hm1yESfs7upvA+MOQbU9NW8dwhTi67rXDm+e5qCwbBZg59gvf50ki0l j5W07/ogJ3AHrEF6XLodob6CDkkz8kZ7VjLQnxvhcylwpGXp8TfMLNxJcNgVAq5ryE/R LroBh2v+GW007H4IPa0deLpFRY3dqbaU1vYEUjZawDGRS3Tf5BMRqLK5adMluCbC8nl9 colg+utgIn0H+Y38L/HGR8N/2H3wbSHbaLSaneV6UysAyCF81ICtZjG0JVkYdtVAEInU 0UPt0I9XnsXjjRYhmKyMejhqacv8/qb63xhbkCqwSKwmPlSxjybEKc65qeQpoRk6clGs oIcg== X-Gm-Message-State: AGi0PuZu88/VRiKyR/MMsBwtYm5kRAX8YXQMonJUCL7xiU2cuJND1HKK nTQefFy2q2Nvn6Febn3VMzBt+FIdr6OyUW1nr7Y= X-Google-Smtp-Source: APiQypJzmbzHIXnncm5a4UeIr7pqODqEAHvkN0Ka9qN/uHq9P/yXu65lMSpfRF70+lk+aiWBFurOo+bo7U6/P9+dji8= X-Received: by 2002:a02:5249:: with SMTP id d70mr1489432jab.121.1586259007110; Tue, 07 Apr 2020 04:30:07 -0700 (PDT) MIME-Version: 1.0 References: <20200331122907.GB62067@kam.mff.cuni.cz> <65230a52-c025-a6e3-0d31-409d37e9b2c9@suse.cz> <20200403152609.GA35629@kam.mff.cuni.cz> <0dbc191e-66f7-9878-956d-96149f20f5bf@suse.cz> In-Reply-To: From: Jonathan Wakely Date: Tue, 7 Apr 2020 11:29:56 +0000 Message-ID: Subject: Re: [PATCH] Check DECL_CONTEXT of new/delete operators. To: Nathan Sidwell Cc: =?UTF-8?Q?Martin_Li=C5=A1ka?= , Jan Hubicka , Richard Biener , GCC Patches , Marc Glisse , Jason Merrill Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, 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: Tue, 07 Apr 2020 11:30:08 -0000 On Mon, 6 Apr 2020 at 13:45, Nathan Sidwell wrote: > The both operator new and operator delete are looked up in the same > manner. The std does not require a 'matching pair' be found. but it is > extremely poor form for a class to declare exactly one of operator > {new,delete}. There are unfortunately several such example in the standard! I wonder how much benefit we will really get from trying to make this optimisation too general. Just eliding (or coalescing) implicit calls to ::operator new(size_t) and ::operator delete(void*, size_t) (and the [] and align_val_t forms of those) probably covers 99% of real cases.