decl.c
549 KB
-
c++: implicit operator== adjustments from P2002. · 1271bdf0
P2002R1, adopted at the February C++ meeting, made several refinements to the wording for operator<=>. This implements clarifications in how the implicit operator== is declared: as a duplicate of the operator<=>, with only the return type and name changed. To that end I factored out the declaration copying from build_clone. For GCC 10 I'm leaving build_clone alone, to reduce the chance of non-C++20-mode regressions. The decl.c changes are a hack to avoid complaining about constraints on a non-template friend that isn't defined in the class. In this case the defaulted comparison operator should be considered defined, but we weren't setting funcdef_flag properly. For GCC 11 I fixed it properly. gcc/cp/ChangeLog: * cp-tree.h (copy_fndecl_with_name): Declare. * class.c (copy_fndecl_with_name): Copy from build_clone. (add_implicitly_declared_members): Add op== to TYPE_FIELDS. * method.c (implicitly_declare_fn): Use copy_fndecl_with_name. * decl.c (grokfndecl): Add initialized parm. (grokdeclarator): Pass it down. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/spaceship-synth9.C: New test.
Jason Merrill committed