diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-06-23 14:08:25 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-06-23 14:08:25 +0000 |
commit | 23d64a17f5ae088c8b6e04f5db94f6cacc0492d2 (patch) | |
tree | 44310bb83003aec8c18da2121e39487979170bd2 /gcc/cp/class.c | |
parent | 435172d141d9080a7944f18d971badf4363a2636 (diff) | |
download | gcc-23d64a17f5ae088c8b6e04f5db94f6cacc0492d2.tar.gz |
PR c++/66501
* class.c (type_has_nontrivial_assignment): New.
* init.c (build_vec_init): Use it.
* cp-tree.h: Declare it.
* method.c (trivial_fn_p): Templates aren't trivial.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@224843 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r-- | gcc/cp/class.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 9da532e18dd..88f1022dcd3 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -5136,6 +5136,24 @@ type_has_non_user_provided_default_constructor (tree t) return false; } +/* Return true if TYPE has some non-trivial assignment operator. */ + +bool +type_has_nontrivial_assignment (tree type) +{ + gcc_assert (TREE_CODE (type) != ARRAY_TYPE); + if (CLASS_TYPE_P (type)) + for (tree fns + = lookup_fnfields_slot_nolazy (type, ansi_assopname (NOP_EXPR)); + fns; fns = OVL_NEXT (fns)) + { + tree fn = OVL_CURRENT (fns); + if (!trivial_fn_p (fn)) + return true; + } + return false; +} + /* TYPE is being used as a virtual base, and has a non-trivial move assignment. Return true if this is due to there being a user-provided move assignment in TYPE or one of its subobjects; if there isn't, then |