From patchwork Fri Mar 10 03:13:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 67188 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp658171wrd; Thu, 9 Mar 2023 19:14:46 -0800 (PST) X-Google-Smtp-Source: AK7set+2zQV7/NQTEEhc4pUry7K6PA4nwxfCs86rTljrjPmKqS8QLPiPebPVMEub1dugKxU8qtiF X-Received: by 2002:aa7:d80c:0:b0:4ad:6db4:b922 with SMTP id v12-20020aa7d80c000000b004ad6db4b922mr22631774edq.14.1678418086359; Thu, 09 Mar 2023 19:14:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678418086; cv=none; d=google.com; s=arc-20160816; b=UwJeNgrxMW3cjpl4KjCnnLR6BsgTPkMsnYczisIRZNfYFpPTxGxtkOenlVxT6FuM/H izXSMMk2qWQlmq6e2F2X3cYfeVtrQBgc6yBao7a2itwU0E9lhyT1CX5aWOAwPyJj04mt 3oQIf8GCqOYZLUYZ04XkwWgBW+3fuaJmRIPFjn/gYGh67dauJLommYZSxAkks6WNQDw3 kunbB9v2elaVu4E3vs3AKtxamqektLR9dnDTzWMCCsQA08e/eBsEkPa+dgC7KIJX59xg 4y2nztWtQ2A1stG+qsJoMLFB2/2DYhf7GcMQhLc7YxSbGo5kfcXe4JLUkedCT+KbSk2D hPNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=bsCswLo8RIidMn8sRngxCJkdRz+1qb60CxoRA+YCPZo=; b=bhdDC42e7rxuTH2L2m4ys/MQaAnPlV58IoXDK4o3GrIc5y8rsvWwX8FvVQ8ZkAtwAR Q4kA1ofcA3427uGqyz/OEDs8KEu8P8FziRgs7mZnKTfhFVtiwGHqjWqARemkiNg/ydTf KPIOs7uq2jCD/1BJJ6tylh8EIqrYqnjP8W12qDdq/92nlBbwOALyn9E+oGz9Wz/in1pI Z0G5VMR04INlO/0k+tR3Bmwf4EH89lFSuCtys6RE/jQipG5LXFUQTFPmYGlQmDf4IBNm 32gRze8MnR4bEXoKA4fkIFae/ov/7BxkW5mTKFghbhszRW8E5i1GsvJr9mjrNXl1B/9h RgWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=wV3i7F9M; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id s6-20020aa7cb06000000b004c43518da54si1000037edt.652.2023.03.09.19.14.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 19:14:46 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=wV3i7F9M; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7EC30385B516 for ; Fri, 10 Mar 2023 03:14:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7EC30385B516 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678418082; bh=bsCswLo8RIidMn8sRngxCJkdRz+1qb60CxoRA+YCPZo=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=wV3i7F9M/7GcApsKUHNaswhv2EDnBkgFDvAhK2v3zDjchpWEpNw7kMoWPKwukttJy v6wEjCY81D5wHdYvE5dmZ1HZrNtryig+JceLjUK3K+MMAHqGvgoL8PrGtjXLsGeq7S c3Fb2e8Edgsi7McABBMeNw2cmNv5kLivmzPF7P6k= 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.129.124]) by sourceware.org (Postfix) with ESMTPS id 545603858C5E for ; Fri, 10 Mar 2023 03:13:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 545603858C5E Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-381-kqxGtVV4MkKFn6GUnd_Chg-1; Thu, 09 Mar 2023 22:13:55 -0500 X-MC-Unique: kqxGtVV4MkKFn6GUnd_Chg-1 Received: by mail-qv1-f70.google.com with SMTP id m1-20020a05621402a100b004bb706b3a27so2301160qvv.20 for ; Thu, 09 Mar 2023 19:13:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678418035; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bsCswLo8RIidMn8sRngxCJkdRz+1qb60CxoRA+YCPZo=; b=vBppN6pUyTr83+3v8rUYhjQJBlf7l2gLZcOwZ3U5hhvFaPyyZronXyHArbJZr0YJ1X dKsjG0V5wowJuDKXjSWMSwQDrxRxoIOiE85xK9WU5K3ZWZb2KhV1RwmaJi+jq2Czcgk0 Kz993lyVd+/LXMcnkM0/yyaeKsYhDomJ4bhbHHSASDakBPDKaXm8fV1Lb76nwGLiVXuR LJ0xWxyp4k0f3DEYwLY+QvPd42Zr1lme9qtqmN+dOD071PzDkhcXFcxgZgybPpoMzDAH S0NDKgPOxOEEDtEK2xhafRb0DgdKgqvMRBZlXYBdglMJsfvnZe8vYqLOCGYYTzwTDCoO 0UCA== X-Gm-Message-State: AO0yUKWlYWIpIUrlB6LuFwVMGkYK54Ds6SmwjJKJWAyM8kszsRbysw1x SqM6ujHUKO+N+OtxpE3WaU7B5ULB9bMD6QfXLMn+ZVV6x5m7NEVtOUB7a9V7klKgsOHq5p5wsyL Q0lcg5MN7PAyhQYT24WnVq11Uyt3uCwQCvC/wefPKCfcJdp0A7L1dR+IGGtlZCPhBhVcWiMNXNQ == X-Received: by 2002:ac8:5c0f:0:b0:3bf:c994:c9ae with SMTP id i15-20020ac85c0f000000b003bfc994c9aemr9359409qti.16.1678418035195; Thu, 09 Mar 2023 19:13:55 -0800 (PST) X-Received: by 2002:ac8:5c0f:0:b0:3bf:c994:c9ae with SMTP id i15-20020ac85c0f000000b003bfc994c9aemr9359389qti.16.1678418034834; Thu, 09 Mar 2023 19:13:54 -0800 (PST) Received: from jason.com (130-44-159-43.s15913.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.159.43]) by smtp.gmail.com with ESMTPSA id i7-20020ae9ee07000000b00743049c2b15sm499272qkg.66.2023.03.09.19.13.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 19:13:54 -0800 (PST) To: gcc-patches@gcc.gnu.org Subject: [pushed] c++: overloaded fn in contract [PR108542] Date: Thu, 9 Mar 2023 22:13:51 -0500 Message-Id: <20230310031351.2404945-1-jason@redhat.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jason Merrill via Gcc-patches From: Jason Merrill Reply-To: Jason Merrill Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759948923326508373?= X-GMAIL-MSGID: =?utf-8?q?1759948923326508373?= Tested x86_64-pc-linux-gnu, applying to trunk. -- 8< -- PR c++/108542 gcc/cp/ChangeLog: * class.cc (instantiate_type): Strip location wrapper. gcc/testsuite/ChangeLog: * g++.dg/contracts/contracts-err1.C: New test. --- gcc/cp/class.cc | 2 ++ gcc/testsuite/g++.dg/contracts/contracts-err1.C | 7 +++++++ 2 files changed, 9 insertions(+) create mode 100644 gcc/testsuite/g++.dg/contracts/contracts-err1.C base-commit: e0324e2629e25a90c13c68b4eef1e47b091970c3 diff --git a/gcc/cp/class.cc b/gcc/cp/class.cc index 27a79829737..d37e9d4d576 100644 --- a/gcc/cp/class.cc +++ b/gcc/cp/class.cc @@ -8728,6 +8728,8 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t complain) complain &= ~tf_ptrmem_ok; + STRIP_ANY_LOCATION_WRAPPER (rhs); + if (lhstype == unknown_type_node) { if (complain & tf_error) diff --git a/gcc/testsuite/g++.dg/contracts/contracts-err1.C b/gcc/testsuite/g++.dg/contracts/contracts-err1.C new file mode 100644 index 00000000000..8437d94e2ad --- /dev/null +++ b/gcc/testsuite/g++.dg/contracts/contracts-err1.C @@ -0,0 +1,7 @@ +// PR c++/108542 +// { dg-additional-options -fcontracts } +// { dg-do compile { target c++11 } } + +template +void f (T n) {} +void g() [[pre: f]]; // { dg-error "overloaded" }