From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 364B23858425; Mon, 27 Mar 2023 22:27:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 364B23858425 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679956035; bh=FX+qSzLwcPIH0BvF5ybI3uI4DxenR3vppOahYS1g++U=; h=From:To:Subject:Date:From; b=BDjm/SfEno5m1mqUytOCM/x9OsTO3i3ZcO9u1ow57G8Ydmyzy0cGKWUjt+usbkS56 rtUQEiqMqZRbCpQCFJJtuweGvFaSwQjl8DugyivWX0M61xwqcBfUV8aVcZPi33JSO8 wx701K8xvofwewKQFWpZLDw9dTnkDP2Sz20BRsfk= From: "slyfox at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109307] New: [13 Regression] constructors fails typecheck on initializer list assignment Date: Mon, 27 Mar 2023 22:27:14 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: slyfox at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D109307 Bug ID: 109307 Summary: [13 Regression] constructors fails typecheck on initializer list assignment Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: slyfox at gcc dot gnu.org Target Milestone: --- Seems to be this week's regression. On gcc-13 webkitgtk-2.38.5 fails to uild as: /home/slyfox/n/webkitgtk-2.38.5/Source/WebCore/platform/graphics/SourceBrus= h.cpp:68:78: error: converting to 'std::optional' from initializer list would use explicit constructor 'constexpr std::optional<_Tp>::optional(_Up&&) [with _Up =3D WebCore::SourceBrush::Brush::LogicalGradient; typename std::enable_if<__and_v, typename std::remove_cv::type>::type> >, std::__not_::type>::type> >, std::is_constructible<_Tp, _U= p>, std::__not_ > >, bool>::type =3D false; _Tp =3D WebCore::SourceBrush::Brush]' 68 | m_brush =3D { Brush::LogicalGradient { WTFMove(gradient), spaceTransform } }; |=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 ^ gcc-12 is fine. I think this is the cmall example that illustrates the fail= ure: // $ cat SourceBrush.cpp #include #include class RefGradient {}; class RefPattern {}; class AffineTransform {}; class SourceBrush { public: struct Brush { struct LogicalGradient { RefGradient gradient; AffineTransform spaceTransform; }; std::variant brush; }; void setGradient(RefGradient &&, const AffineTransform & spaceTransform= =3D { }); void setPattern(RefPattern &&); private: std::optional m_brush; }; void SourceBrush::setGradient(RefGradient&& gradient, const AffineTransform& spaceTransform) { m_brush =3D { Brush::LogicalGradient { std::move(gradient), spaceTransf= orm } }; } void SourceBrush::setPattern(RefPattern&& pattern) { m_brush =3D { std::move(pattern) }; } gcc-12 works: $ g++-12.2.0 SourceBrush.cpp -c -std=3Dc++20 $ g++-13.0.0 SourceBrush.cpp -c -std=3Dc++20 SourceBrush.cpp: In member function 'void SourceBrush::setGradient(RefGradient&&, const AffineTransform&)': SourceBrush.cpp:28:80: error: converting to 'std::optional' from initializer list would use explicit constructor 'constexpr std::optional<_Tp>::optional(_Up&&) [with _Up =3D SourceBrush::Brush::LogicalGradient; typename std::enable_if<__and_v, typename std::remove_cv::type>::type> >, std::__not_::type>::type> >, std::is_constructible<_Tp, _U= p>, std::__not_ > >, bool>::type =3D = false; _Tp =3D SourceBrush::Brush]' 28 | m_brush =3D { Brush::LogicalGradient { std::move(gradient), spaceTransform } }; |=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 ^ SourceBrush.cpp: In member function 'void SourceBrush::setPattern(RefPattern&&)': SourceBrush.cpp:33:36: error: converting to 'std::optional' from initializer list would use explicit constructor 'constexpr std::optional<_Tp>::optional(_Up&&) [with _Up =3D RefPattern; typename std::enable_if<__and_v, typename std::remove_cv::type>::type> >, std::__not_::type>::type> >, std::is_constructible<_Tp, _U= p>, std::__not_ > >, bool>::type =3D = false; _Tp =3D SourceBrush::Brush]' 33 | m_brush =3D { std::move(pattern) }; | ^ $ g++-13.0.0 -v Using built-in specs. COLLECT_GCC=3D/<>/gcc-13.0.0/bin/g++ COLLECT_LTO_WRAPPER=3D/<>/gcc-13.0.0/libexec/gcc/x86_64-unknown-linux-= gnu/13.0.1/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: Thread model: posix Supported LTO compression algorithms: zlib gcc version 13.0.1 20230326 (experimental) (GCC)=