File nov141311.diff of Package gcc33
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.282.4.6
retrieving revision 1.282.4.7
diff -u -r1.282.4.6 -r1.282.4.7
--- gcc/gcc/cp/semantics.c 2003/07/06 22:02:17 1.282.4.6
+++ gcc/gcc/cp/semantics.c 2004/09/13 08:39:12 1.282.4.7
@@ -2457,7 +2457,28 @@
else if (TREE_CODE (*tp) == CLEANUP_STMT
&& CLEANUP_DECL (*tp) == nrv)
CLEANUP_EH_ONLY (*tp) = 1;
-
+ /* Replace the DECL_STMT for the NRV with an initialization of the
+ RESULT_DECL, if needed. */
+ else if (TREE_CODE (*tp) == DECL_STMT
+ && DECL_STMT_DECL (*tp) == nrv)
+ {
+ tree init;
+ if (DECL_INITIAL (nrv)
+ && DECL_INITIAL (nrv) != error_mark_node)
+ {
+ init = build (INIT_EXPR, void_type_node,
+ DECL_RESULT (current_function_decl),
+ DECL_INITIAL (nrv));
+ DECL_INITIAL (nrv) = error_mark_node;
+ }
+ else
+ init = NULL_TREE;
+ init = build_stmt (EXPR_STMT, init);
+ TREE_CHAIN (init) = TREE_CHAIN (*tp);
+ STMT_LINENO (init) = STMT_LINENO (*tp);
+ *tp = init;
+ }
+
/* Keep iterating. */
return NULL_TREE;
}