From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 204823858C5F; Thu, 9 Feb 2023 17:31:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 204823858C5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675963902; bh=4YblAayhjSSW86Dme+FuP0Ixi7lZsQsoEqLZ5P2j7Ko=; h=From:To:Subject:Date:From; b=MAhyi8rsbvyovV4MZitFDXgxdb68qj7hkLN2uSA0JY8eTms0/5K7ujhMbr+Nf6ETM cbCzD5tr0Opj9l9y+jBoj8TsWWR8iVgArwECoE1PF4adiDK7eklA5inRUPJg5zJ6sN B2SAXCODFhLXI5i4pCO/a3D0gsyTtJnQoSF3ubG4= From: "barry.revzin at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/108744] New: error message when trying to use structured bindings in static member declaration could be cleaner Date: Thu, 09 Feb 2023 17:31:41 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: barry.revzin at gmail dot com X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D108744 Bug ID: 108744 Summary: error message when trying to use structured bindings in static member declaration could be cleaner Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- Consider: struct X { int i, j; }; struct C { static auto [a, b] =3D X{1, 2}; }; This is ill-formed, but the error is currently: :6:17: error: expected unqualified-id before '[' token 6 | static auto [a, b] =3D X{1, 2}; | ^ clang, in contrast, says: :6:17: error: decomposition declaration not permitted in this conte= xt static auto [a, b] =3D X{1, 2}; ^~~~~~ Which is a lot clearer. I think ideally the error states explicitly that structured bindings can't be used in static data member declarations.=