Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/gcc-patches:master commit in: 11.1.0/gentoo/
Date: Fri, 28 May 2021 22:20:37
Message-Id: 1622240371.f3f23b533c01b783dc53023f9b9f8fe343b151dc.slyfox@gentoo
1 commit: f3f23b533c01b783dc53023f9b9f8fe343b151dc
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Fri May 28 22:19:31 2021 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Fri May 28 22:19:31 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=f3f23b53
7
8 11.1.0: backport PR100644: c++: "perfect" implicitly deleted move
9
10 Reported-by: Thomas Deutschmann
11 Bug: https://bugs.gentoo.org/792705
12 Bug: https://gcc.gnu.org/PR100644
13 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
14
15 .../gentoo/29_all_perfect-implicit-PR100644.patch | 69 ++++++++++++++++++++++
16 11.1.0/gentoo/README.history | 1 +
17 2 files changed, 70 insertions(+)
18
19 diff --git a/11.1.0/gentoo/29_all_perfect-implicit-PR100644.patch b/11.1.0/gentoo/29_all_perfect-implicit-PR100644.patch
20 new file mode 100644
21 index 0000000..35ee13d
22 --- /dev/null
23 +++ b/11.1.0/gentoo/29_all_perfect-implicit-PR100644.patch
24 @@ -0,0 +1,69 @@
25 +https://gcc.gnu.org/PR100644
26 +https://bugs.gentoo.org/792705
27 +
28 +From 6384e940a6db379b0524465cf6cbbd0996b48485 Mon Sep 17 00:00:00 2001
29 +From: Jason Merrill <jason@××××××.com>
30 +Date: Tue, 18 May 2021 12:06:36 -0400
31 +Subject: [PATCH] c++: "perfect" implicitly deleted move [PR100644]
32 +
33 +Here we were ignoring the template constructor because the implicit move
34 +constructor had all perfect conversions. But CWG1402 says that an
35 +implicitly deleted move constructor is ignored by overload resolution; we
36 +implement that instead by preferring any other candidate in joust, to get
37 +better diagnostics, but that means we need to handle that case here as well.
38 +
39 +gcc/cp/ChangeLog:
40 +
41 + PR c++/100644
42 + * call.c (perfect_candidate_p): An implicitly deleted move
43 + is not perfect.
44 +
45 +gcc/testsuite/ChangeLog:
46 +
47 + * g++.dg/cpp0x/implicit-delete1.C: New test.
48 +---
49 + gcc/cp/call.c | 5 +++++
50 + gcc/testsuite/g++.dg/cpp0x/implicit-delete1.C | 20 +++++++++++++++++++
51 + 2 files changed, 25 insertions(+)
52 + create mode 100644 gcc/testsuite/g++.dg/cpp0x/implicit-delete1.C
53 +
54 +--- a/gcc/cp/call.c
55 ++++ b/gcc/cp/call.c
56 +@@ -5892,6 +5892,11 @@ perfect_candidate_p (z_candidate *cand)
57 + {
58 + if (cand->viable < 1)
59 + return false;
60 ++ /* CWG1402 makes an implicitly deleted move op worse than other
61 ++ candidates. */
62 ++ if (DECL_DELETED_FN (cand->fn) && DECL_DEFAULTED_FN (cand->fn)
63 ++ && move_fn_p (cand->fn))
64 ++ return false;
65 + int len = cand->num_convs;
66 + for (int i = 0; i < len; ++i)
67 + if (!perfect_conversion_p (cand->convs[i]))
68 +--- /dev/null
69 ++++ b/gcc/testsuite/g++.dg/cpp0x/implicit-delete1.C
70 +@@ -0,0 +1,20 @@
71 ++// PR c++/100644
72 ++// { dg-do compile { target c++11 } }
73 ++
74 ++struct NonMovable {
75 ++ NonMovable(NonMovable&&) = delete;
76 ++};
77 ++
78 ++template <class T>
79 ++struct Maybe {
80 ++ NonMovable mMember;
81 ++
82 ++ template <typename U>
83 ++ Maybe(Maybe<U>&&);
84 ++};
85 ++
86 ++void foo(Maybe<int>);
87 ++
88 ++void unlucky(Maybe<int>&& x) {
89 ++ Maybe<int> var{(Maybe<int>&&)x};
90 ++}
91 +--
92 +2.31.1
93 +
94
95 diff --git a/11.1.0/gentoo/README.history b/11.1.0/gentoo/README.history
96 index 27dd8ff..00f2ee7 100644
97 --- a/11.1.0/gentoo/README.history
98 +++ b/11.1.0/gentoo/README.history
99 @@ -1,6 +1,7 @@
100 2 TODO
101 + 27_all_msp430-f2c.patch
102 + 28_all_ctor-union-PR100489.patch
103 + + 29_all_perfect-implicit-PR100644.patch
104
105 1 27 Apr 2021
106 + 01_all_default-fortify-source.patch