aboutsummaryrefslogtreecommitdiff
path: root/libgo/go
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-12-22 20:18:10 +0100
committerJakub Jelinek <jakub@redhat.com>2020-12-22 20:18:10 +0100
commitffd454b92ba6ff5499cf57f82a2b0f4cee59978c (patch)
tree8e9be7258613548484c6d7e387cea7c9c66b4862 /libgo/go
parentae27ce51e4860388d2b4129e2a80cc7f292368b5 (diff)
downloadgcc-ffd454b92ba6ff5499cf57f82a2b0f4cee59978c.zip
gcc-ffd454b92ba6ff5499cf57f82a2b0f4cee59978c.tar.gz
gcc-ffd454b92ba6ff5499cf57f82a2b0f4cee59978c.tar.bz2
c++: Handle array members in build_comparison_op [PR93480]
http://eel.is/c++draft/class.compare.default#6 says for the expanded list of subobjects: "In that list, any subobject of array type is recursively expanded to the sequence of its elements, in the order of increasing subscript." but build_comparison_op just tried to compare the whole arrays, which failed and therefore the defaulted comparison was deleted. The following patch instead compares the array elements, and if info.defining, adds runtime loops around it so that it iterates over increasing subscripts. For flexible array members it punts, we don't know how large those will be, for zero sized arrays it doesn't even try to compare the elements, because if there are no elements, there is nothing to compare, and for [1] arrays it will not emit a loop because it is enough to use [0] array ref to cover everything. 2020-12-21 Jakub Jelinek <jakub@redhat.com> PR c++/93480 * method.c (common_comparison_type): If comps[i] is a TREE_LIST, use its TREE_VALUE instead. (build_comparison_op): Handle array members. * g++.dg/cpp2a/spaceship-synth10.C: New test. * g++.dg/cpp2a/spaceship-synth-neg5.C: New test.
Diffstat (limited to 'libgo/go')
0 files changed, 0 insertions, 0 deletions