public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/108744] New: error message when trying to use structured bindings in static member declaration could be cleaner @ 2023-02-09 17:31 barry.revzin at gmail dot com 2023-02-09 17:35 ` [Bug c++/108744] " pinskia at gcc dot gnu.org ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: barry.revzin at gmail dot com @ 2023-02-09 17:31 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108744 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] = X{1, 2}; }; This is ill-formed, but the error is currently: <source>:6:17: error: expected unqualified-id before '[' token 6 | static auto [a, b] = X{1, 2}; | ^ clang, in contrast, says: <source>:6:17: error: decomposition declaration not permitted in this context static auto [a, b] = 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. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/108744] error message when trying to use structured bindings in static member declaration could be cleaner 2023-02-09 17:31 [Bug c++/108744] New: error message when trying to use structured bindings in static member declaration could be cleaner barry.revzin at gmail dot com @ 2023-02-09 17:35 ` pinskia at gcc dot gnu.org 2023-02-09 17:56 ` mpolacek at gcc dot gnu.org 2023-02-09 18:28 ` barry.revzin at gmail dot com 2 siblings, 0 replies; 4+ messages in thread From: pinskia at gcc dot gnu.org @ 2023-02-09 17:35 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108744 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Last reconfirmed| |2023-02-09 Status|UNCONFIRMED |NEW --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Confirmed. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/108744] error message when trying to use structured bindings in static member declaration could be cleaner 2023-02-09 17:31 [Bug c++/108744] New: error message when trying to use structured bindings in static member declaration could be cleaner barry.revzin at gmail dot com 2023-02-09 17:35 ` [Bug c++/108744] " pinskia at gcc dot gnu.org @ 2023-02-09 17:56 ` mpolacek at gcc dot gnu.org 2023-02-09 18:28 ` barry.revzin at gmail dot com 2 siblings, 0 replies; 4+ messages in thread From: mpolacek at gcc dot gnu.org @ 2023-02-09 17:56 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108744 Marek Polacek <mpolacek at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mpolacek at gcc dot gnu.org --- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> --- Looks like it doesn't even need to be static. Are structured bindings generally banned in data members? ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/108744] error message when trying to use structured bindings in static member declaration could be cleaner 2023-02-09 17:31 [Bug c++/108744] New: error message when trying to use structured bindings in static member declaration could be cleaner barry.revzin at gmail dot com 2023-02-09 17:35 ` [Bug c++/108744] " pinskia at gcc dot gnu.org 2023-02-09 17:56 ` mpolacek at gcc dot gnu.org @ 2023-02-09 18:28 ` barry.revzin at gmail dot com 2 siblings, 0 replies; 4+ messages in thread From: barry.revzin at gmail dot com @ 2023-02-09 18:28 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108744 --- Comment #3 from Barry Revzin <barry.revzin at gmail dot com> --- Yeah, they're banned in non-static data members also. But there, we just can't have any "auto" non-static data members, whereas you can have "auto" static data members (just not structured bindings). ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-02-09 18:28 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-02-09 17:31 [Bug c++/108744] New: error message when trying to use structured bindings in static member declaration could be cleaner barry.revzin at gmail dot com 2023-02-09 17:35 ` [Bug c++/108744] " pinskia at gcc dot gnu.org 2023-02-09 17:56 ` mpolacek at gcc dot gnu.org 2023-02-09 18:28 ` barry.revzin at gmail dot com
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).