diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8329fb3fc8e..26841bb1eb3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2001-12-08 John David Anglin + + * semantics.c (simplify_aggr_init_exprs_r): Add DIRECT_BIND flag in + call to build_aggr_init. + * cp-tree.h (DIRECT_BIND): Document new use of DIRECT_BIND. + 2001-12-08 Neil Booth * parse.y: Replace uses of the string non-terminal with STRING. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 420e2d9fed0..992c708aee2 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -3312,7 +3312,10 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG }; LOOKUP_ONLYCONVERTING means that non-conversion constructors are not tried. DIRECT_BIND means that if a temporary is created, it should be created so that it lives as long as the current variable bindings; otherwise it - only lives until the end of the complete-expression. + only lives until the end of the complete-expression. It also forces + direct-initialization in cases where other parts of the compiler have + already generated a temporary, such as reference initialization and the + catch parameter. LOOKUP_SPECULATIVELY means return NULL_TREE if we cannot find what we are after. Note, LOOKUP_COMPLAIN is checked and error messages printed before LOOKUP_SPECULATIVELY is checked. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 75cfa6965b1..776f06fb627 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2320,7 +2320,8 @@ simplify_aggr_init_exprs_r (tp, walk_subtrees, data) int old_ac = flag_access_control; flag_access_control = 0; - call_expr = build_aggr_init (slot, call_expr, LOOKUP_ONLYCONVERTING); + call_expr = build_aggr_init (slot, call_expr, + DIRECT_BIND | LOOKUP_ONLYCONVERTING); flag_access_control = old_ac; copy_from_buffer_p = 1; }