From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 84FCF3858428; Mon, 17 Jun 2024 19:03:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 84FCF3858428 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1718651002; bh=GXN2idyu6e3815LJwvKOMNUAF2NcvEeJprAJ2yvNsq0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Tjyb4I6fqoBIS/vZJ+KFBWkWWgkiMotxga45iZ8hkMDYKVouUh6MvDVklY/IJjZQO ibA/CN/GBk+UJFNzcndTGu5bFNOATYXk6FWNinfrNzgB2euH+d2aj85zF8zYRqJdzr y90b4y31kaUDpUh8wyzs7bPv+bIlT7CVKgxv1Xhk= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/115522] [13/14/15 Regression] std::to_array no longer works for struct which is trivial but not default constructible Date: Mon, 17 Jun 2024 19:03:21 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 13.3.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D115522 --- Comment #4 from Jonathan Wakely --- (In reply to Jonathan Wakely from comment #3) > static_assert(is_constructible_v<_Tp, _Tp&>); > if constexpr (is_constructible_v<_Tp, _Tp&>) > { > - if constexpr (is_trivial_v<_Tp>) > + if constexpr (is_trivial_v<_Tp> && is_default_constructible_v<_= Tp> > + && is_copy_assignable_v<_Tp>) For the testcase above, it would be sufficient to do: if constexpr (is_trivial_v<_Tp> && is_copy_assignable_v<_Tp>) The type with const members isn't assignable. I'm not sure if this covers all cases. I think combined with is_trivial it should do, but then I don't understand why the struct ranges type is trivia= l in the first place.=