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.