c++: defaulted comparisons and vptr fields [PR95567]
authorPatrick Palka <ppalka@redhat.com>
Thu, 30 Sep 2021 21:29:05 +0000 (17:29 -0400)
committerPatrick Palka <ppalka@redhat.com>
Thu, 30 Sep 2021 21:29:05 +0000 (17:29 -0400)
commitb6bca2e631b54f992c058ca8e445b45e9816690b
treeac911b7f42efb7d6176ed747a1a2ed699a7a7937
parentbffb580d6f0e8b6f9623128d38ea653a99a58d49
c++: defaulted comparisons and vptr fields [PR95567]

We need to explicitly skip over vptr fields when synthesizing a
defaulted comparison operator, because next_initializable_field
doesn't do so for us.

PR c++/95567

gcc/cp/ChangeLog:

* method.c (build_comparison_op): Skip DECL_VIRTUAL_P fields.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/spaceship-virtual1.C: New test.
gcc/cp/method.c
gcc/testsuite/g++.dg/cpp2a/spaceship-virtual1.C [new file with mode: 0644]