summaryrefslogtreecommitdiff
path: root/gcc/cp/init.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2010-12-08 20:00:37 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2010-12-08 20:00:37 +0000
commited2deec6f4667bd99b80bac2fe31450e1f4ad30d (patch)
tree5c4c91efbfc591c63836997af7094151c6fd8702 /gcc/cp/init.c
parent21f80a31bf2440b3b8a62f20fa6298be6cb769b6 (diff)
downloadgcc-ed2deec6f4667bd99b80bac2fe31450e1f4ad30d.tar.gz
PR c++/45822
* cp-tree.h (LOOKUP_DEFAULTED): New. * call.c (add_function_candidate): Check it. * method.c (synthesized_method_walk): Set it. (do_build_copy_assign): Likewise. * init.c (perform_member_init): Likewise. (emit_mem_initializers): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@167602 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r--gcc/cp/init.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 9de8c9f61c3..5a4f91cfb2b 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -503,6 +503,9 @@ perform_member_init (tree member, tree init)
}
else
{
+ int flags = LOOKUP_NORMAL;
+ if (DECL_DEFAULTED_FN (current_function_decl))
+ flags |= LOOKUP_DEFAULTED;
if (CP_TYPE_CONST_P (type)
&& init == NULL_TREE
&& !type_has_user_provided_default_constructor (type))
@@ -511,7 +514,7 @@ perform_member_init (tree member, tree init)
permerror (DECL_SOURCE_LOCATION (current_function_decl),
"uninitialized member %qD with %<const%> type %qT",
member, type);
- finish_expr_stmt (build_aggr_init (decl, init, 0,
+ finish_expr_stmt (build_aggr_init (decl, init, flags,
tf_warning_or_error));
}
}
@@ -852,11 +855,16 @@ sort_mem_initializers (tree t, tree mem_inits)
void
emit_mem_initializers (tree mem_inits)
{
+ int flags = LOOKUP_NORMAL;
+
/* We will already have issued an error message about the fact that
the type is incomplete. */
if (!COMPLETE_TYPE_P (current_class_type))
return;
+ if (DECL_DEFAULTED_FN (current_function_decl))
+ flags |= LOOKUP_DEFAULTED;
+
/* Sort the mem-initializers into the order in which the
initializations should be performed. */
mem_inits = sort_mem_initializers (current_class_type, mem_inits);
@@ -908,7 +916,7 @@ emit_mem_initializers (tree mem_inits)
cp_build_indirect_ref (base_addr, RO_NULL,
tf_warning_or_error),
arguments,
- LOOKUP_NORMAL,
+ flags,
tf_warning_or_error);
expand_cleanup_for_base (subobject, NULL_TREE);
}