Bug 102617 - [C++23] P2360R0 - Extend init-statement to allow alias-declaration
Summary: [C++23] P2360R0 - Extend init-statement to allow alias-declaration
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 12.0
: P3 normal
Target Milestone: ---
Assignee: Marek Polacek
URL:
Keywords:
Depends on:
Blocks: c++23-core
  Show dependency treegraph
 
Reported: 2021-10-05 16:52 UTC by Marek Polacek
Modified: 2021-10-26 15:44 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2021-10-05 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Polacek 2021-10-05 16:52:34 UTC
See https://wg21.link/p2360r0
Comment 1 CVS Commits 2021-10-26 15:35:52 UTC
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:5469d58d6620195c6275d11b474d686f5921c3ba

commit r12-4716-g5469d58d6620195c6275d11b474d686f5921c3ba
Author: Marek Polacek <polacek@redhat.com>
Date:   Thu Oct 21 11:10:02 2021 -0400

    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.
Comment 2 Marek Polacek 2021-10-26 15:44:26 UTC
Implemented in GCC 12.