From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8271B3858CD1; Tue, 9 Apr 2024 05:14:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8271B3858CD1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712639642; bh=ghaey84gOSOiNgTNM2+tPWQykyA8lsDQCaKMKdeFsXA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=W7A3TMsHUp/y2LtxSodgxnu1Q7ebwqx58FSknng38COKo9q5uIQkVyOqqpgqKaz4Z PKzzSFau65TFO0OyskSkiyCtTw9K58sPs0fO0IPrzgTHqJPOdQfPT7F5dZzYlejLw1 qLC672dCDxSoSedbLTTK6OQCfeLibEdOJrY+k45A= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/86885] gcc erroneously allows constructor/destructor attributes on nested functions Date: Tue, 09 Apr 2024 05:14:01 +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: unknown X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cf_known_to_fail 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=3D86885 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Known to fail| |4.1.2 --- Comment #2 from Andrew Pinski --- Hmm, the code does: if (TREE_CODE (decl) =3D=3D FUNCTION_DECL && TREE_CODE (type) =3D=3D FUNCTION_TYPE && decl_function_context (decl) =3D=3D 0) { Which means this was supposed to be rejected (decl_function_context is supp= osed to return if the context of a function is a function or not) but maybe we s= et the DECL_CONTEXT of the function too late now. The decl_function_context check has been there since constructor attribute support was added by Jason in 1995 (r0-8721-g2c5f4139a91db2) . I am 90% sure this worked at one point but I have no way to test anything earlier than 4.= 1.2 though.=