aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/call.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2021-05-18 12:06:36 -0400
committerJason Merrill <jason@redhat.com>2021-05-18 15:43:52 -0400
commitf71ca97def69b8aeb046d716eaea2367736f505e (patch)
tree88b68e43f8096d9e174ee4505e6eef639ae0661f /gcc/cp/call.c
parentcd323d97d0592135ca4345701ef051659d8d4507 (diff)
downloadgcc-f71ca97def69b8aeb046d716eaea2367736f505e.zip
gcc-f71ca97def69b8aeb046d716eaea2367736f505e.tar.gz
gcc-f71ca97def69b8aeb046d716eaea2367736f505e.tar.bz2
c++: "perfect" implicitly deleted move [PR100644]
Here we were ignoring the template constructor because the implicit move constructor had all perfect conversions. But CWG1402 says that an implicitly deleted move constructor is ignored by overload resolution; we implement that instead by preferring any other candidate in joust, to get better diagnostics, but that means we need to handle that case here as well. gcc/cp/ChangeLog: PR c++/100644 * call.c (perfect_candidate_p): An implicitly deleted move is not perfect. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/implicit-delete1.C: New test.
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r--gcc/cp/call.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 1e2d1d4..4a59b97 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -5890,6 +5890,11 @@ perfect_candidate_p (z_candidate *cand)
{
if (cand->viable < 1)
return false;
+ /* CWG1402 makes an implicitly deleted move op worse than other
+ candidates. */
+ if (DECL_DELETED_FN (cand->fn) && DECL_DEFAULTED_FN (cand->fn)
+ && move_fn_p (cand->fn))
+ return false;
int len = cand->num_convs;
for (int i = 0; i < len; ++i)
if (!perfect_conversion_p (cand->convs[i]))