Implement P0305R1, Selection statements with initializer.
authorMarek Polacek <polacek@redhat.com>
Wed, 5 Oct 2016 18:02:06 +0000 (18:02 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Wed, 5 Oct 2016 18:02:06 +0000 (18:02 +0000)
commit17a9e3802a32f39707a2ac260f8f97b665a44c87
tree226e1dc1f2ccd43d3ad167bef4ae957897611f43
parent6e48e779aba92a8d7e89210c2d98d9b2a65d9a36
Implement P0305R1, Selection statements with initializer.

* cp-array-notation.c (create_an_loop): Call finish_init_stmt
instead of finish_for_init_stmt.
* cp-tree.h (finish_for_init_stmt): Rename to finish_init_stmt.
* decl.c (poplevel): Adjust a comment.
* init.c (build_vec_init): Call finish_init_stmt instead of
finish_for_init_stmt.
* name-lookup.c (pushdecl_maybe_friend_1): Adjust a comment.
* name-lookup.h (enum scope_kind): Likewise.
* parser.c (cp_parser_statement): Update commentary.
(cp_parser_init_statement_p): New function.
(cp_parser_selection_statement): Parse the optional init-statement.
(cp_parser_for): Call finish_init_stmt instead of finish_for_init_stmt.
(cp_parser_c_for): Likewise.
(cp_convert_range_for): Call finish_init_stmt instead of finish_for_init_stmt.
(cp_parser_range_for_member_function): Update commentary.
(cp_parser_iteration_statement):
(cp_parser_for_init_statement): Rename to cp_parser_init_statement.
* pt.c (tsubst_omp_for_iterator): Update commentary.
(tsubst_expr): Call finish_init_stmt instead of finish_for_init_stmt.
* semantics.c (finish_for_init_stmt): Rename to finish_init_stmt.
Update commentary.

* g++.dg/cpp1z/init-statement1.C: New test.
* g++.dg/cpp1z/init-statement2.C: New test.
* g++.dg/cpp1z/init-statement3.C: New test.
* g++.dg/cpp1z/init-statement4.C: New test.
* g++.dg/cpp1z/init-statement5.C: New test.
* g++.dg/cpp1z/init-statement6.C: New test.
* g++.dg/cpp1z/init-statement7.C: New test.
* g++.dg/cpp1z/init-statement8.C: New test.

From-SVN: r240798
19 files changed:
gcc/cp/ChangeLog
gcc/cp/cp-array-notation.c
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/init.c
gcc/cp/name-lookup.c
gcc/cp/name-lookup.h
gcc/cp/parser.c
gcc/cp/pt.c
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1z/init-statement1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/init-statement2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/init-statement3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/init-statement4.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/init-statement5.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/init-statement6.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/init-statement7.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/init-statement8.C [new file with mode: 0644]