diff options
author | Jason Merrill <jason@redhat.com> | 2010-06-29 20:50:57 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2010-06-29 20:50:57 -0400 |
commit | ac1774315cb7ebc781ade2f9fd99de1c258b9221 (patch) | |
tree | 0e8e64d29daa126b9fc1f87bfe35a0967270da6d /gcc/cp/tree.c | |
parent | 4640884658bae7ba9ff09068efcbe4b7e94baf8d (diff) | |
download | gcc-ac1774315cb7ebc781ade2f9fd99de1c258b9221.zip gcc-ac1774315cb7ebc781ade2f9fd99de1c258b9221.tar.gz gcc-ac1774315cb7ebc781ade2f9fd99de1c258b9221.tar.bz2 |
Machinery to support implicit delete/move.
* cp-tree.h: (struct lang_type_class): Add lazy_move_assign,
has_complex_move_ctor, has_complex_move_assign bitfields.
(CLASSTYPE_LAZY_MOVE_ASSIGN): New.
(TYPE_HAS_COMPLEX_MOVE_ASSIGN): New.
(TYPE_HAS_COMPLEX_MOVE_CTOR): New.
(enum special_function_kind): Add sfk_move_assignment.
(LOOKUP_SPECULATIVE): New.
* call.c (build_over_call): Return early if it's set.
(build_over_call): Use trivial_fn_p.
* class.c (check_bases): If the base has no default constructor,
the derived one is non-trivial. Handle move ctor/op=.
(check_field_decl): Likewise.
(check_bases_and_members): Handle move ctor/op=.
(add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN.
(type_has_move_constructor, type_has_move_assign): New.
* decl.c (grok_special_member_properties): Handle move ctor/op=.
* method.c (type_has_trivial_fn, type_set_nontrivial_flag): New.
(trivial_fn_p): New.
(do_build_copy_constructor): Use it.
(do_build_assign_ref): Likewise. Handle move assignment.
(build_stub_type, build_stub_object, locate_fn_flags): New.
(locate_ctor): Use locate_fn_flags.
(locate_copy, locate_dtor): Remove.
(get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New.
(process_subob_fn, synthesized_method_walk): New.
(maybe_explain_implicit_delete): New.
(implicitly_declare_fn): Use synthesized_method_walk,
type_has_trivial_fn, and type_set_nontrivial_flag.
(defaulted_late_check): Set DECL_DELETED_FN.
(defaultable_fn_check): Handle sfk_move_assignment.
(lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare
implicitly deleted move ctor/op=.
* search.c (lookup_fnfields_1): Handle sfk_move_assignment.
(lookup_fnfields_slot): New.
* semantics.c (omp_clause_info_fndecl): Remove.
(cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor,
get_copy_assign, trivial_fn_p.
(trait_expr_value): Adjust call to locate_ctor.
* tree.c (special_function_p): Handle sfk_move_assignment.
From-SVN: r161579
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r-- | gcc/cp/tree.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 7236924..3367a09 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -2847,7 +2847,12 @@ special_function_p (const_tree decl) if (DECL_CONSTRUCTOR_P (decl)) return sfk_constructor; if (DECL_OVERLOADED_OPERATOR_P (decl) == NOP_EXPR) - return sfk_copy_assignment; + { + if (copy_fn_p (decl)) + return sfk_copy_assignment; + if (move_fn_p (decl)) + return sfk_move_assignment; + } if (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (decl)) return sfk_destructor; if (DECL_COMPLETE_DESTRUCTOR_P (decl)) |