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++/85723] [C++17][DR 1496] __is_trivial intrinsic fails with no trivial non-deleted default c'tor
Date: Fri, 21 Jun 2024 09:15:42 +0000	[thread overview]
Message-ID: <bug-85723-4-VNJFxPzEVe@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-85723-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:510ce5eed69ee1bea9c2c696fe3b2301e16d1486

commit r15-1533-g510ce5eed69ee1bea9c2c696fe3b2301e16d1486
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Jun 18 13:27:02 2024 +0100

    libstdc++: Fix std::to_array for trivial-ish types [PR115522]

    Due to PR c++/85723 the std::is_trivial trait is true for types with a
    deleted default constructor, so the use of std::is_trivial in
    std::to_array is not sufficient to ensure the type can be trivially
    default constructed then filled using memcpy.

    I also forgot that a type with a deleted assignment operator can still
    be trivial, so we also need to check that it's assignable because the
    is_constant_evaluated() path can't use memcpy.

    Replace the uses of std::is_trivial with std::is_trivially_copyable
    (needed for memcpy), std::is_trivially_default_constructible (needed so
    that the default construction is valid and does no work) and
    std::is_copy_assignable (needed for the constant evaluation case).

    libstdc++-v3/ChangeLog:

            PR libstdc++/115522
            * include/std/array (to_array): Workaround the fact that
            std::is_trivial is not sufficient to check that a type is
            trivially default constructible and assignable.
            * testsuite/23_containers/array/creation/115522.cc: New test.

      parent reply	other threads:[~2024-06-21  9:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-85723-4@http.gcc.gnu.org/bugzilla/>
2024-06-18 12:15 ` redi at gcc dot gnu.org
2024-06-18 16:54 ` pinskia at gcc dot gnu.org
2024-06-18 17:06 ` mpolacek at gcc dot gnu.org
2024-06-19 13:56 ` mpolacek at gcc dot gnu.org
2024-06-21  9:15 ` cvs-commit at gcc dot gnu.org [this message]

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-85723-4-VNJFxPzEVe@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).