From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 8FD353851151 for ; Fri, 28 Oct 2022 15:15:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8FD353851151 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666970157; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8njrRpm/v7KeIX65WOznppNZne673MF+U6kI4hFoNXI=; b=T2dKKGAHViLiiMd6aT96cGzu+UJ52vxo9NXQQDRQUCwz6u86tDJmH9oMmqdMqATeNY35sX 8iZRUwjaoYogMKnGuG6RK1EUkOcWQ1hm42+/PIhML7V8Gfj8CEueAc+SRzVeaEg1WD9NfK Oj7dL5xUzY1hOuz7P+jyyu4rhA9SZHQ= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-605-QRqj6OUMM4iZy2eogEoF5g-1; Fri, 28 Oct 2022 11:15:56 -0400 X-MC-Unique: QRqj6OUMM4iZy2eogEoF5g-1 Received: by mail-qt1-f200.google.com with SMTP id br5-20020a05622a1e0500b00394c40fee51so3514354qtb.17 for ; Fri, 28 Oct 2022 08:15:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=8njrRpm/v7KeIX65WOznppNZne673MF+U6kI4hFoNXI=; b=z82MO9liewMk7PB716w/1Foo9v+E/b+jCVlqIvHG33nQA/mjvlc0xmDK89+ntdhZCE /25JpJ6IwKkx1Pqgh7OQhSbQYIPIQab0lGupHr8L488GIF8SxoqQwvzKGzzvdBpYvyqy aWRLpekTNXDgrDDy9iLI4ygGlT66FouGuO3AJO280M7oP4WjsWVMlWqt1/mI5RrCsVHa nzjBvW+hSAmBwZAIYTrznwOFycCIHSnK76uV+jFky+9tXsae5D4AeFbAoEnudXByjeFV jLuvQ2kvwyT1gz9eekFKvQp+qeJU5Q1G4LpHM+p/u1RNOaH9vyeJ/tk2HvgvhKoD7IV8 e5YA== X-Gm-Message-State: ACrzQf2Omy1r+phRQ0hzRjGF/RY5vM9w3kGeqDR11mPpGw1BFpp9l68E HgQzMOFI3vDcw9TiHskDPb7SUUYqlMSiRM0EWTn0s0cRqqd9L2bd5uNuOHdbwKbyU4p1fFnDa5Z mg+o3FP2sMV1+xlbEO9rg4A2kNga2728tTaTAAgGntgBUHO4sNcsGAmYDCND1qoWTcw== X-Received: by 2002:a05:6214:2461:b0:4bb:4aa2:e59e with SMTP id im1-20020a056214246100b004bb4aa2e59emr31866568qvb.98.1666970156012; Fri, 28 Oct 2022 08:15:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Yms/3t4ghvqvl6a/AHfqcZrtYzkoaaiFepSzgFCtXRbhQFfTk2atO+TuOMvToTxadpPg+6w== X-Received: by 2002:a05:6214:2461:b0:4bb:4aa2:e59e with SMTP id im1-20020a056214246100b004bb4aa2e59emr31866537qvb.98.1666970155679; Fri, 28 Oct 2022 08:15:55 -0700 (PDT) Received: from barrymore.redhat.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 de12-20020a05620a370c00b006e99290e83fsm3049555qkb.107.2022.10.28.08.15.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Oct 2022 08:15:55 -0700 (PDT) From: Jason Merrill To: gcc-patches@gcc.gnu.org Subject: [pushed] c++: apply friend attributes sooner Date: Fri, 28 Oct 2022 11:15:53 -0400 Message-Id: <20221028151553.918472-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 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-12.9 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 List-Id: Tested x86_64-pc-linux-gnu, applying to trunk. -- >8 -- Comparing attributes between declarations of a friend function has been complicated by pushdecl happening before decl_attributes. I assumed there was some complicated reason we weren't calling decl_attributes here, but it doesn't break anything. gcc/cp/ChangeLog: * decl.cc (grokdeclarator): Call decl_attributes before do_friend. --- gcc/cp/decl.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc index bc085f8fcce..c7f1937ea48 100644 --- a/gcc/cp/decl.cc +++ b/gcc/cp/decl.cc @@ -14206,13 +14206,16 @@ grokdeclarator (const cp_declarator *declarator, else if (decl && DECL_NAME (decl)) { set_originating_module (decl, true); - + if (initialized) /* Kludge: We need funcdef_flag to be true in do_friend for in-class defaulted functions, but that breaks grokfndecl. So set it here. */ funcdef_flag = true; + cplus_decl_attributes (&decl, *attrlist, 0); + *attrlist = NULL_TREE; + decl = do_friend (ctype, unqualified_id, decl, flags, funcdef_flag); return decl; base-commit: 4fe34cdcc80ac225b80670eabc38ac5e31ce8a5a -- 2.31.1