]> gcc.gnu.org Git - gcc.git/commit
c++: P2360R0: Extend init-stmt to allow alias-decl [PR102617]
authorMarek Polacek <polacek@redhat.com>
Thu, 21 Oct 2021 15:10:02 +0000 (11:10 -0400)
committerMarek Polacek <polacek@redhat.com>
Tue, 26 Oct 2021 15:34:53 +0000 (11:34 -0400)
commit5469d58d6620195c6275d11b474d686f5921c3ba
treec74e8137c6408bff107f4a2bfbfd89d5a9474855
parent28006282028b548238cee4601117f21c498dc2b7
c++: P2360R0: Extend init-stmt to allow alias-decl [PR102617]

The following patch implements C++23 P2360R0.  This proposal merely
extends init-statement to contain alias-declaration.  init-statement
is used in if/for/switch.  It also removes the unsightly duplication
of code by calling cp_parser_init_statement twice.

PR c++/102617

gcc/cp/ChangeLog:

* parser.c (cp_parser_for): Maybe call cp_parser_init_statement
twice.  Warn about range-based for loops with initializer here.
(cp_parser_init_statement): Don't duplicate code.  Allow
alias-declaration in init-statement.

gcc/testsuite/ChangeLog:

* g++.dg/cpp23/init-stmt1.C: New test.
* g++.dg/cpp23/init-stmt2.C: New test.
gcc/cp/parser.c
gcc/testsuite/g++.dg/cpp23/init-stmt1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp23/init-stmt2.C [new file with mode: 0644]
This page took 0.059954 seconds and 6 git commands to generate.