PR c++/11295
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 1 Aug 2003 09:34:09 +0000 (09:34 +0000)
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 1 Aug 2003 09:34:09 +0000 (09:34 +0000)
commit942ab15bc1a3ec6a744bca6ee544ad0cd3459949
treebbb501c90255aea4dd7368daf077d8f0d4280c1c
parent1cc57cf8fb921c68995c837ff99aaed68dbfb31e
PR c++/11295
* doc/extend.texi (Statement Expressions): Document C++ semantics.
cp:
PR c++/11295
* cp-tree.h (tubst_flags_t): Add tf_stmt_expr_cmpd,
tf_stmt_expr_body.
(finish_stmt_expr_expr): Declare.
* parser.c (cp_parser_primary_expression): Tell
cp_parser_compount_statement that it is a statement expression.
(cp_parser_statement, cp_parser_labeled_statement,
cp_parser_compound_statement, cp_parser_statement_seq_opt): Add
in_statement_expr_p parameter.
(cp_parser_expression_statement): Likewise. Call
finish_stmt_expr_expr for final expression of a statement
expression.
(cp_parser_for_init_statement,
cp_parser_implicitly_scoped_statement,
cp_parser_already_scoped_statement, cp_parser_function_definition,
cp_parser_try_block, cp_parser_handled): Adjust.
* pt.c (tsubst_copy) <STMT_EXPR case>: Pass tf_stmt_expr.
(tsubst_expr): Process tf_stmt_expr and tf_stmt_exprs flags.
(tsubst_expr) <EXPR_STMT case>: Check tf_stmt_exprs flag.
* semantics.c (finish_expr_stmt): Do not deal with statement
expressions.
(begin_stmt_expr): Clear last_expr_type.
(finish_stmt_expr_expr): New.
(finish_stmt_expr): Process the value expression.
testsuite:
PR c++/11295
* g++.dg/ext/stmtexpr1.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@70043 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/parser.c
gcc/cp/pt.c
gcc/cp/semantics.c
gcc/doc/extend.texi
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/stmtexpr1.C [new file with mode: 0644]