diff options
author | Jason Merrill <jason@redhat.com> | 2021-04-23 16:41:35 -0400 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2021-04-27 15:42:40 -0400 |
commit | 37846c42f1f5ac4d9ba190d49c4373673c89c8b5 (patch) | |
tree | 821c2142813930cca7cb4b70aadd1795a1321731 /gcc/cp/class.c | |
parent | 37d2b98100cefcb9d312d379473c12aa6d61fc62 (diff) | |
download | gcc-37846c42f1f5ac4d9ba190d49c4373673c89c8b5.tar.gz |
c++: -Wdeprecated-copy and using operator= [PR92145]
For the purpose of [depr.impldec] "if the class has a user-declared copy
assignment operator", an operator= brought in from a base class with 'using'
may be a copy-assignment operator, but it isn't a copy-assignment operator
for the derived class.
gcc/cp/ChangeLog:
PR c++/92145
* class.c (classtype_has_depr_implicit_copy): Check DECL_CONTEXT
of operator=.
gcc/testsuite/ChangeLog:
PR c++/92145
* g++.dg/cpp0x/depr-copy3.C: New test.
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r-- | gcc/cp/class.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 90b343803a0..2cf527e4a84 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -5670,7 +5670,8 @@ classtype_has_depr_implicit_copy (tree t) iter; ++iter) { tree fn = *iter; - if (user_provided_p (fn) && copy_fn_p (fn)) + if (DECL_CONTEXT (fn) == t + && user_provided_p (fn) && copy_fn_p (fn)) return fn; } |