From patchwork Wed Sep 25 13:57:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1989418 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Zx+twOTo; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XDJGT3Gggz1xt4 for ; Wed, 25 Sep 2024 23:58:09 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 338A7385841D for ; Wed, 25 Sep 2024 13:58:07 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 85F483858C50 for ; Wed, 25 Sep 2024 13:57:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 85F483858C50 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 85F483858C50 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727272671; cv=none; b=EDNHHkQj6SGa7/7NeAAbpNjp3/WkuP5/0LjZmugzUUOBPMafBmzISCQVEIgwBgCkuTOczKO12jRng+qbD9xAyD/S3ot7LHGY2HfEoa6CjJrF+nYYZPLK3YmWlmfTOAtXMgIb/dFGaqIOrh0L0CFOd/rqy7e6Mdl7r2ZuELwPVGE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727272671; c=relaxed/simple; bh=41/6m9a+v7OCbDBAzfsAOtVyQSxBErZOJrEM97jzhYk=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=R9fz/th9qciZjl55QC/gfX4DYIkO+A4Tc2nBCiifonShqwOuYo2HMiBg45+fN/oQ+3LwMB2x43yg5pzfK4t3qGGxdSheS9sURg/sIkN6QO08aBy/qtcQ+r12mhc3IflOqUJ6hSrt7kdGETNfanaSxYOkS02h1c+laYJE3s5O41o= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727272670; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=MfLbX6egcr46Y8BQSN8RbGugVqwNLDpuR2PhzSadpU4=; b=Zx+twOToRgCobfsAMjImV5RRBUbxo64ngxz/UxwB2roZstJXI13NMW+S6ayr3jPMw95p1A t5fu8V2T1i6DEzp+bmBkH8Yb1wUtrUwbPbNhbBJRCSPnNsswUV1akWsdM5U9vSVg/wmgyL TZg5Jfq0tvRotpajZ8WC+GV7+E82gFE= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-622-T-ngOakSNRm3Mbwhj_R8rA-1; Wed, 25 Sep 2024 09:57:49 -0400 X-MC-Unique: T-ngOakSNRm3Mbwhj_R8rA-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (unknown [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 44C0B193585C for ; Wed, 25 Sep 2024 13:57:48 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.45.224.61]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A329519560A3; Wed, 25 Sep 2024 13:57:47 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 48PDvjtH1152134 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 25 Sep 2024 15:57:45 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 48PDviS81152133; Wed, 25 Sep 2024 15:57:44 +0200 Date: Wed, 25 Sep 2024 15:57:44 +0200 From: Jakub Jelinek To: Jason Merrill Cc: gcc-patches@gcc.gnu.org, Marek Polacek Subject: [PATCH] c++: Add testcase for DR 2728 Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_NUMSUBJECT, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org Hi! Seems we already handle delete expressions the way the DR clarifies, so this patch just adds a testcase which verifies that. Tested on x86_64-linux, ok for trunk? 2024-09-25 Jakub Jelinek * g++.dg/DRs/dr2728.C: New test. Jakub --- gcc/testsuite/g++.dg/DRs/dr2728.C.jj 2024-09-25 13:44:15.102534622 +0200 +++ gcc/testsuite/g++.dg/DRs/dr2728.C 2024-09-25 13:44:09.876605940 +0200 @@ -0,0 +1,20 @@ +// DR 2728 - Evaluation of conversions in a delete-expression +// { dg-do run } + +struct S { + S (int *x) : p (x) {} + operator int * () const { ++s; return p; } + int *p; + static int s; +}; +int S::s; + +int +main () +{ + int *a = new int; + S s (a); + delete s; + if (S::s != 1) + __builtin_abort (); +}