aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/class.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2020-02-11 12:04:37 +0100
committerJason Merrill <jason@redhat.com>2020-02-12 01:07:41 +0100
commitd6ef77e023cfe0bb3b12b88ae46b77da356d7f85 (patch)
treea70bf6c80ef0ce4f40fb73e7428ec56e9d3d80b7 /gcc/cp/class.c
parent9a5338e57db1cda13fa788b0e0debbcf99a475d6 (diff)
downloadgcc-d6ef77e023cfe0bb3b12b88ae46b77da356d7f85.zip
gcc-d6ef77e023cfe0bb3b12b88ae46b77da356d7f85.tar.gz
gcc-d6ef77e023cfe0bb3b12b88ae46b77da356d7f85.tar.bz2
c++: Fix implicit friend operator==.
It seems that in writing testcases for the operator<=> proposal I didn't include any tests for implicitly declared friend operator==, and consequently it didn't work. 2020-02-11 Jason Merrill <jason@redhat.com> PR c++/93675 * class.c (add_implicitly_declared_members): Use do_friend. * method.c (implicitly_declare_fn): Fix friend handling. (decl_remember_implicit_trigger_p): New. (synthesize_method): Use it. * decl2.c (mark_used): Use it.
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r--gcc/cp/class.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 719c3ec..f9e46ca 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -3241,7 +3241,11 @@ add_implicitly_declared_members (tree t, tree* access_decls,
{
tree eq = implicitly_declare_fn (sfk_comparison, t, false, space,
NULL_TREE);
- add_method (t, eq, false);
+ if (DECL_FRIEND_P (space))
+ do_friend (NULL_TREE, DECL_NAME (eq), eq,
+ NULL_TREE, NO_SPECIAL, true);
+ else
+ add_method (t, eq, false);
}
while (*access_decls)