re PR c++/5373 (Statement expressions broken in C++)
PR c++ 5373. * g++.dg/parse/stmtexpr1.C: New test. PR c++/5373. * semantics.c (finish_expr_stmt): Remember the type of the expression before any conversions are performed. From-SVN: r52264
This commit is contained in:
parent
1d405c5eba
commit
0481bc2173
@ -1,3 +1,9 @@
|
||||
2002-04-12 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/5373.
|
||||
* semantics.c (finish_expr_stmt): Remember the type of the
|
||||
expression before any conversions are performed.
|
||||
|
||||
2002-04-12 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/5189.
|
||||
|
@ -203,6 +203,7 @@ finish_expr_stmt (expr)
|
||||
tree expr;
|
||||
{
|
||||
tree r = NULL_TREE;
|
||||
tree expr_type = NULL_TREE;;
|
||||
|
||||
if (expr != NULL_TREE)
|
||||
{
|
||||
@ -213,6 +214,9 @@ finish_expr_stmt (expr)
|
||||
|| TREE_CODE (TREE_TYPE (expr)) == FUNCTION_TYPE))
|
||||
expr = default_conversion (expr);
|
||||
|
||||
/* Remember the type of the expression. */
|
||||
expr_type = TREE_TYPE (expr);
|
||||
|
||||
if (stmts_are_full_exprs_p ())
|
||||
expr = convert_to_void (expr, "statement");
|
||||
|
||||
@ -223,7 +227,7 @@ finish_expr_stmt (expr)
|
||||
|
||||
/* This was an expression-statement, so we save the type of the
|
||||
expression. */
|
||||
last_expr_type = expr ? TREE_TYPE (expr) : NULL_TREE;
|
||||
last_expr_type = expr_type;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
2002-04-12 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++ 5373.
|
||||
* g++.dg/parse/stmtexpr1.C: New test.
|
||||
|
||||
PR c++/5189.
|
||||
* call.c (add_template_candidate_real): Do not treat member
|
||||
templates as copy constructors.
|
||||
* g++.dg/template/copy1.C: New test.
|
||||
|
||||
2002-04-12 Richard Henderson <rth@redhat.com>
|
||||
|
||||
|
9
gcc/testsuite/g++.dg/parse/stmtexpr1.C
Normal file
9
gcc/testsuite/g++.dg/parse/stmtexpr1.C
Normal file
@ -0,0 +1,9 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "" }
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int a = ({ 1 ? 0 : 1; });
|
||||
return ({ argc > 1 ? 1 : 0; });
|
||||
}
|
Loading…
Reference in New Issue
Block a user