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.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 0d29ce4c801..bf5b53f5ab1 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -7558,6 +7558,9 @@ build_new_method_call_1 (tree instance, tree fns, vec<tree, va_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);