From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 61F8F3857014; Fri, 16 Sep 2022 16:30:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 61F8F3857014 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663345830; bh=AJlBU+U4IoTrHcTYTTEwdjizvWiJIRoL1oFkeAGrpUY=; h=From:To:Subject:Date:From; b=YfNOaNchbLhQH/0Z5I7J70yPuorPebxhtaBSTcPuduYt02FwIn0cKpbkA57WgsfTM MvNCH1WSmEtoLNPUi/x3D6vEgnxAyDpoQfRwCtiXdMgU5nkrsg8+JYVqcbyK7EgYCm dr0Iea8w+9Rp1bzhU+G+JwKxaPjfEvC4XooQ8lU0= From: "enricomaria.dean6elis at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/106957] New: compiler error when calling lambda in decltype in trailing return type of function templated on T when passing T{} to the lambda Date: Fri, 16 Sep 2022 16:30:30 +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: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: enricomaria.dean6elis at gmail dot com 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 attachments.created 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=3D106957 Bug ID: 106957 Summary: compiler error when calling lambda in decltype in trailing return type of function templated on T when passing T{} to the lambda Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: enricomaria.dean6elis at gmail dot com Target Milestone: --- Created attachment 53586 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D53586&action=3Dedit the output/error upon compilation Repro on godbolt (https://godbolt.org/z/9T5aEnzYa) Question on stackoverlow with a comment sayint that the code would be illeg= al anyway: https://stackoverflow.com/questions/73747517/sfinae-ing-on-a-nullary-lambda= -expression-calling-a-non-templated-function-on-a Here's the code ``` #include constexpr auto f =3D [](int){}; template auto canCallFOn(T) -> decltype([]{ f(T{}); }(), std::true_type{}); constexpr std::false_type canCallFOn(...) { return {}; } int main() { static_assert(!canCallFOn(1)); static_assert(!canCallFOn("")); } ```=