https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117784
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:c81447d969f27a8653ebb1a450372f0d25a2e628 commit r16-2108-gc81447d969f27a8653ebb1a450372f0d25a2e628 Author: Jakub Jelinek <ja...@redhat.com> Date: Tue Jul 8 19:21:55 2025 +0200 c++: Implement part of C++26 P2686R4 - constexpr structured bindings [PR117784] The following patch implements the constexpr structured bindings part of the P2686R4 paper, so the [dcl.pre], [dcl.struct.bind], [dcl.constinit] and first hunk in [dcl.constexpr] changes. The paper doesn't have a feature test macro and the constexpr structured binding part of it seems more-less self-contained, so I think it is useful to get this in independently from the rest. Of course, automatic constexpr/constinit structured bindings in the tuple cases or automatic constexpr/constinit structured bindings with auto & will not really work for now. Another reason for the split is that for C++ < 26, I think what the patch implements is basically what the users will see, i.e. we can accept constexpr or constinit structured binding with pedwarn, but I think we can't change the constant expression rules in C++ < 26. I plan to look at the rest of the paper. 2025-07-08 Jakub Jelinek <ja...@redhat.com> PR c++/117784 * decl.cc: Implement part of C++26 P2686R4 - constexpr structured bindings. (cp_finish_decl): Pedwarn for C++23 and older on constinit on structured bindings except for static/thread_local where it uses earlier error. (grokdeclarator): Pedwarn on constexpr structured bindings for C++23 and older instead of emitting error always, don't clear constexpr_p in that case. * parser.cc (cp_parser_decomposition_declaration): Copy over DECL_DECLARED_CONSTEXPR_P and DECL_DECLARED_CONSTINIT_P flags. * g++.dg/cpp1z/decomp3.C (test): For constexpr structured binding initialize from constexpr var instead of non-constexpr and expect just a pedwarn for C++23 and older instead of error always. * g++.dg/cpp26/decomp9.C (foo): Likewise. * g++.dg/cpp26/decomp22.C: New test. * g++.dg/cpp26/decomp23.C: New test. * g++.dg/cpp26/decomp24.C: New test. * g++.dg/cpp26/decomp25.C: New test.