From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AEB5C3858039; Sun, 22 Nov 2020 20:25:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AEB5C3858039 From: "elel at 3wh dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/97938] New: g++ crash when inferring type of auto parameter pack in lambda capture Date: Sun, 22 Nov 2020 20:25:32 +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: 10.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: elel at 3wh dot net 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 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: Sun, 22 Nov 2020 20:25:32 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97938 Bug ID: 97938 Summary: g++ crash when inferring type of auto parameter pack in lambda capture Product: gcc Version: 10.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: elel at 3wh dot net Target Milestone: --- The following test case: #include #include template int print_args(Args&&... args) { std::cout << (args << ...); return sizeof...(args); } template auto fwd(const T1& t1, const T2& t2) { return std::apply([&t2] (auto&&... ts1) { return std::apply([...ts1 =3D std::forward(ts1)] (auto&&= ... ts2) { return print_args(ts1..., std::forward(ts2)...); }, t2); }, t1); } int main() { auto t1 =3D std::make_tuple(int{1}, float{2}); auto t2 =3D std::make_tuple(float{3}, int{4}); return fwd(t1, t2); } Compiled as: g++ -std=3Dc++20 -g -O2 gcc_crash.cpp Crashes g++ with the following message: gcc_crash.cpp: In instantiation of =E2=80=98fwd, std::tuple >:: [with auto:11 =3D {const = int&, const float&}]=E2=80=99: /usr/include/c++/10.2.0/type_traits:2506:26: required by substitution of =E2=80=98template static std::__result_of_succe= ss()((declval<_Args>)()...)), std::__invoke_other> std::__result_of_other_impl::_S_test(int) [with _Fn =3D fwd, std::tuple >::; _Args =3D {const= int&, const float&}]=E2=80=99 /usr/include/c++/10.2.0/type_traits:2517:55: required from =E2=80=98struct std::__result_of_impl, std::tuple >::, const int&, const float&= >=E2=80=99 /usr/include/c++/10.2.0/type_traits:138:12: recursively required by substitution of =E2=80=98template struct std::__is_invocable_impl<_Result, _Ret, true, std::__void_t > [with _Result =3D std::__invoke_result, std::tuple >::, const int&, const float&= >; _Ret =3D void]=E2=80=99 /usr/include/c++/10.2.0/type_traits:138:12: required from =E2=80=98struct std::__and_, std::tuple >::, const int&, const float&>, void, true, void>, std::__call_is_nothrow, std::tuple >::, const int&, const float&= >, fwd, std::tuple >::, const int&, const float&> >=E2=80=99 /usr/include/c++/10.2.0/type_traits:2979:12: required from =E2=80=98struct std::is_nothrow_invocable, std::tuple >::, const int&, const float&>=E2=80=99 /usr/include/c++/10.2.0/tuple:1715:37: required from =E2=80=98constexpr c= onst bool std::__unpack_std_tuple struct std::is_nothrow_invocable, fwd, std::tuple >::, const std::tuple&>=E2=80=99 /usr/include/c++/10.2.0/tuple:1730:14: required from =E2=80=98constexpr decltype(auto) std::apply(_Fn&&, _Tuple&&) [with _Fn =3D fwd, std::tuple >::; _Tuple =3D const std::tuple&]=E2=80=99 gcc_crash.cpp:12:20: required from =E2=80=98auto fwd(const T1&, const T2&= ) [with T1 =3D std::tuple; T2 =3D std::tuple]=E2=80=99 gcc_crash.cpp:22:20: required from here gcc_crash.cpp:13:23: internal compiler error: Segmentation fault 13 | return std::apply([...ts1 =3D std::forward(ts1)] (auto&&... ts2) { |=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 14 | return print_args(ts1..., std::forward(ts2)...= ); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~ 15 | }, t2); | ~=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 Please submit a full bug report, with preprocessed source if appropriate. In other scenarios (not the minimal test case above) the same bug triggers = the message: internal compiler error: in cxx_incomplete_type_diagnostic, at cp/typeck2.c= :584=