From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1102B3858D37; Fri, 28 Apr 2023 21:09:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1102B3858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682716193; bh=oQcH3BirPlAtjx8FNcx6BBEDUPByJsoNjRQXjhHjVuU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=h+3X0mNOqGaIwbxjZe6Y8tQMRO9JPhQ1KO91VQAMyEYgSO1Dz0NMtW6/7Ur5cYnHy Uk7OPnYea2xA/nL3WqngxSrnAFdmWxxIMsHa1NE5+Ome9sjqybCYjQ8g3vYKMdjuLu QAH6Ca1Ks0z5ii8Sx8E9nH1R6MrK7NfwnkngTnwg= From: "richard-gccbugzilla at metafoo dot co.uk" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109654] unnecessary "cannot bind packed field to reference" error when referenced type has aligned(1) attribute Date: Fri, 28 Apr 2023 21:09:52 +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: X-Bugzilla-Severity: normal X-Bugzilla-Who: richard-gccbugzilla at metafoo dot co.uk X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID 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: 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=3D109654 --- Comment #2 from Richard Smith --- Hm, that doesn't explain why the second example I gave is accepted. But I suppose what's happening there is probably just that the `packed` attribute= is ignored entirely for fields with alignment 1, so this behaves the same as ``` packed_int i; int &r =3D i; ``` ... which indeed doesn't produce an error or even a warning, presumably for= the same reason (the alignment isn't part of the canonical type of i).=