From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5831B385BF81; Fri, 10 Apr 2020 17:55:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5831B385BF81 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1586541337; bh=sNaov+jvL+nLPsD5nh89vCrlB7Hj9cKo9oB4N2l0Ypg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ncsCR1xanWxPUkmsKHMIXAaFiUcACeB828gH2TDe6ohV5OLl8hfIUCIdW5azUNahg O4lr0bGUUVOJYfYBtsQoLGfjmjoCYsZfKLcwEWjFCQRqnJ+8LoIPFhAXEAyOWye6Up H35rP3md9rwlR+mcykRUkItJTsn6R/HLp8r2dNUQ= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/94149] __is_constructible doesn't know about C++20 parenthesized init for arrays Date: Fri, 10 Apr 2020 17:55:37 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: patch, rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: mpolacek at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Apr 2020 17:55:37 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94149 --- Comment #5 from CVS Commits --- The master branch has been updated by Marek Polacek : https://gcc.gnu.org/g:62c25d7adb1a5664982449dda0e7f9ca63cf4735 commit r10-7681-g62c25d7adb1a5664982449dda0e7f9ca63cf4735 Author: Marek Polacek Date: Thu Apr 9 16:31:59 2020 -0400 c++: make __is_constructible work with paren-init of aggrs [PR94149] In C++20 this is well-formed: using T =3D int[2]; T t(1, 2); which means that std::is_constructible_v should be tr= ue. But constructible_expr immediately returned the error_mark_node when it saw a list with more than one element. To give accurate results in C++20, we have to try initializing the aggregate from a parenthesized l= ist of values. To not repeat the same mistake as in c++/93790, if there's only one element, I'm trying {} only when () didn't succeed. is_constructible5.C verifies this. In paren-init24.C std::is_nothrow_constructible_v doesn't work due to error: invalid 'static_cast' from type 'int' to type 'int [1]' and error: functional cast to array type 'int [2]' This needs to be fixed in libstdc++. PR c++/94149 * method.c (constructible_expr): In C++20, try using parenthesi= zed initialization of aggregates to determine the result of __is_constructible. * g++.dg/cpp2a/paren-init24.C: New test. * g++.dg/cpp2a/paren-init25.C: New test. * g++.dg/ext/is_constructible5.C: New test.=