From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2849938708D1; Sat, 15 Jun 2024 12:55:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2849938708D1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1718456121; bh=THNHfL7aCq5yb6boEyVaE+72ZMy8MFH0b+Ofhgk4qSg=; h=From:To:Subject:Date:From; b=YDWLUwrQQIn2bEx8bVA+QlWO2jScHgmpfB5EzOFICJ7DTw4qVGsCqFTve6NHzQwPg 7NBAyh5EDqr81BNXJxMNmdnjIf38qlqx+5IZnVzYmFoJ3Ae0r94TH4rOF8s/Ggyn2e q6u5REz9v8yw4r0s/8vTjZHVGPWQ1E0yk10VcZ5M= From: "fchelnokov at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/115504] New: Wrong decltype result for a captured reference inside limbda Date: Sat, 15 Jun 2024 12:55:20 +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: 14.1.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: fchelnokov 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 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=3D115504 Bug ID: 115504 Summary: Wrong decltype result for a captured reference inside limbda Product: gcc Version: 14.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: fchelnokov at gmail dot com Target Milestone: --- This program ``` template int foo() =3D delete; template<> int foo() { return 0; } int main() {=20 int y =3D 0; int &i =3D y; return [&i]() { decltype(auto) x =3D i; return foo(); }(); } ``` is accepted in Clang, MSVC and GCC 13.3, but not in GCC 14, which thinks th= at `decltype(x)=3Dint`. Online demo: https://gcc.godbolt.org/z/fc1nrP4P9 Related discussion: https://stackoverflow.com/a/78626163/7325599=