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 libstdc++/115522] [13/14 Regression] std::to_array no longer works for struct which is trivial but not default constructible Date: Fri, 12 Jul 2024 11:11:42 +0000 [thread overview] Message-ID: <bug-115522-4-rFrNubLUoo@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-115522-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115522 --- Comment #12 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-13 branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>: https://gcc.gnu.org/g:08463348c5cce84dc3c64ac4fbb20e2795ee104f commit r13-8908-g08463348c5cce84dc3c64ac4fbb20e2795ee104f 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. (cherry picked from commit 510ce5eed69ee1bea9c2c696fe3b2301e16d1486)
next prev parent reply other threads:[~2024-07-12 11:11 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-06-17 12:13 [Bug libstdc++/115522] New: " daniel.klauer at gin dot de 2024-06-17 15:11 ` [Bug libstdc++/115522] [13/14/15 Regression] " pinskia at gcc dot gnu.org 2024-06-17 15:15 ` pinskia at gcc dot gnu.org 2024-06-17 16:17 ` redi at gcc dot gnu.org 2024-06-17 19:03 ` redi at gcc dot gnu.org 2024-06-18 12:14 ` redi at gcc dot gnu.org 2024-06-18 12:47 ` redi at gcc dot gnu.org 2024-06-19 16:39 ` redi at gcc dot gnu.org 2024-06-20 2:31 ` de34 at live dot cn 2024-06-21 9:15 ` cvs-commit at gcc dot gnu.org 2024-07-12 10:19 ` [Bug libstdc++/115522] [13/14 " cvs-commit at gcc dot gnu.org 2024-07-12 10:21 ` redi at gcc dot gnu.org 2024-07-12 10:21 ` redi at gcc dot gnu.org 2024-07-12 11:11 ` cvs-commit at gcc dot gnu.org [this message] 2024-07-12 11:12 ` redi at gcc dot gnu.org 2024-07-18 19:15 ` cvs-commit at gcc dot gnu.org
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-115522-4-rFrNubLUoo@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: linkBe 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).