public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/93480] Defaulted <=> doesn't expand array elements
Date: Tue, 22 Dec 2020 19:19:06 +0000	[thread overview]
Message-ID: <bug-93480-4-SHeBtu5LHw@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-93480-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93480

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:ffd454b92ba6ff5499cf57f82a2b0f4cee59978c

commit r11-6305-gffd454b92ba6ff5499cf57f82a2b0f4cee59978c
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Dec 22 20:18:10 2020 +0100

    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.

  parent reply	other threads:[~2020-12-22 19:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-93480-4@http.gcc.gnu.org/bugzilla/>
2020-12-18 19:28 ` wjwray at gmail dot com
2020-12-19 22:17 ` wjwray at gmail dot com
2020-12-20 14:23 ` jakub at gcc dot gnu.org
2020-12-21 22:49 ` wjwray at gmail dot com
2020-12-22 19:19 ` cvs-commit at gcc dot gnu.org [this message]
2020-12-22 19:19 ` jakub at gcc dot gnu.org
2021-01-18 15:18 ` ppalka at gcc dot gnu.org
2021-04-22 19:32 ` ppalka at gcc dot gnu.org
2022-12-26 17:50 ` pinskia at gcc dot gnu.org
2022-12-26 17:51 ` rhalbersma at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-93480-4-SHeBtu5LHw@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).