summaryrefslogtreecommitdiff
path: root/gcc/cp/call.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r--gcc/cp/call.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 5e74f56e55f..6fab65443ae 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -7218,6 +7218,9 @@ build_new_method_call_1 (tree instance, tree fns, VEC(tree,gc) **args,
build_special_member_call. */
if (CONSTRUCTOR_NELTS (init_list) == 0
&& TYPE_HAS_DEFAULT_CONSTRUCTOR (basetype)
+ /* For a user-provided default constructor, use the normal
+ mechanisms so that protected access works. */
+ && !type_has_user_provided_default_constructor (basetype)
&& !processing_template_decl)
init = build_value_init (basetype, complain);
@@ -8773,6 +8776,12 @@ extend_ref_init_temps_1 (tree decl, tree init, VEC(tree,gc) **cleanups)
tree sub = init;
tree *p;
STRIP_NOPS (sub);
+ if (TREE_CODE (sub) == COMPOUND_EXPR)
+ {
+ TREE_OPERAND (sub, 1)
+ = extend_ref_init_temps_1 (decl, TREE_OPERAND (sub, 1), cleanups);
+ return init;
+ }
if (TREE_CODE (sub) != ADDR_EXPR)
return init;
/* Deal with binding to a subobject. */