From 788f3e3e00e8adfe37d3392f6bd8212b1aa76a95 Mon Sep 17 00:00:00 2001 From: mmitchel Date: Thu, 25 May 2006 20:18:26 +0000 Subject: PR c++/20103 * gimplify.c (gimplify_decl_expr): Do not call gimple_add_tmp_var for anonymous variables explicitly declared by front ends. PR c++/20103 * decl.c (cp_make_fname_decl): Don't set DECL_INITIAL to error_mark_node to indicate an initialization is OK. (start_decl): Likewise. Adjust call to start_decl_1. (start_decl_1): Add initialized parameter. Simplify. * except.c (initialize_handler_parm): Adjust call to setart_decl_1. (expand_start_catch_block): Let cp_finish_decl initialize catch parameters. * cp-tree.h (start_decl_1): Adjust prototype. * pt.c (tsubst_expr): Don't set DECL_INITIAL to error_mark_node. (instantiate_decl): Let cp_finish_decl handle initialization. * semantics.c (finish_compound_literal): Create a temporary variable for the literal. * typeck.c (build_unary_op): Remove COMPOUND_LITERAL_P special cases. * decl2.c (finish_static_data_member_decl): Don't set DECL_INITIAL. (grokfield): Do not try to initialize functions. PR c++/20103 * g++.dg/ext/complit6.C: New test. * g++.dg/ext/complit3.C: Adjust error markers. * g++.dg/init/const3.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114119 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 103b36ef123..fe18bc19234 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -1216,10 +1216,12 @@ gimplify_decl_expr (tree *stmt_p) walk_tree (&init, force_labels_r, NULL, NULL); } - /* This decl isn't mentioned in the enclosing block, so add it to the - list of temps. FIXME it seems a bit of a kludge to say that - anonymous artificial vars aren't pushed, but everything else is. */ - if (DECL_ARTIFICIAL (decl) && DECL_NAME (decl) == NULL_TREE) + /* Some front ends do not explicitly declare all anonymous + artificial variables. We compensate here by declaring the + variables, though it would be better if the front ends would + explicitly declare them. */ + if (!DECL_SEEN_IN_BIND_EXPR_P (decl) + && DECL_ARTIFICIAL (decl) && DECL_NAME (decl) == NULL_TREE) gimple_add_tmp_var (decl); } -- cgit v1.2.1