From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8273D3857004; Mon, 12 Sep 2022 19:27:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8273D3857004 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663010838; bh=SoSMGPJ7LXfWduakjjDU8jO2IqI/blYj6f+fgwV7f20=; h=From:To:Subject:Date:In-Reply-To:References:From; b=wYoWPRiZ5hITo1xrQUMrshlNfwdt2Q6dYA9/vCE6MGYe0kfCtJxILVgvEJgeZY8XU B0OL+J+TSX5GguSv8pIosye3R+ermSKKdVQ52U/drgOQIDwnPNuPK8CK4GkXPZffef kVswC3OG7yq7++SXe+uUr4dIBJCRbv/9vBEO3XjA= From: "jason at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/106756] [CWG1699] Overbroad friendship for nested classes Date: Mon, 12 Sep 2022 19:27:18 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: jason at gcc dot gnu.org X-Bugzilla-Status: SUSPENDED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: short_desc cf_reconfirmed_on everconfirmed bug_status Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106756 Jason Merrill changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|[13 Regression] Overbroad |[CWG1699] Overbroad |friendship for nested |friendship for nested |classes |classes Last reconfirmed| |2022-09-12 Ever confirmed|0 |1 Status|UNCONFIRMED |SUSPENDED --- Comment #3 from Jason Merrill --- (In reply to S. Davis Herring from comment #2) > That said, one can make a similar argument along the lines of "B is a > member-declaration of A, and so f is part of a member-declaration itself", Exactly. > which puts us back on the old question of whether it matters whether the > friend is defined inside the class. Indeed, GCC still rejects the example > modified to use >=20 > int f(A::B*) {return A::i;} Yes, because there the definition of f is not (part of) a member-declaratio= n. Friends defined in the class body are different in various ways from normal functions that happen to be friends; it makes sense to me for this to be one such. Suspending pending the resolution of CWG1699.=