From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C03A9385697B; Fri, 7 Jul 2023 09:06:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C03A9385697B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688720774; bh=jwUF3zeFJzqfmhpZMyhH/iKyReckLgY5+HYNWjKbD7Y=; h=From:To:Subject:Date:From; b=rL7PT8cNOupAeOhzi6+URXG9lPu6CfEK8H4BDVD5jD9tD4dP/CjWNPavSM0R19DwF AZ7aFkzeYqF/F+6QwztPRFSinb8mcc1WhaTbPvfttSCznZ/VEB9ISd0OldUH4oFW1I H05POPxGvZb0S5z7gLw0o1tbvMlAC5ZPj3RSjnaw= From: "fchelnokov at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/110584] New: Constant is not visible in nested lambda Date: Fri, 07 Jul 2023 09:06: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.1.0 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=3D110584 Bug ID: 110584 Summary: Constant is not visible in nested lambda Product: gcc Version: 13.1.0 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 (created by my colleague Artur) void foo(float); int main() { constexpr float x =3D 0; (void)[&] () { foo(x); (void)[] () { foo(x); }; }; } is accepted in Clang and MSVC, but GCC complains: error: 'x' is not captured note: the lambda has no capture-default 'const float& x' declared here 5 | foo(x); Online demo: https://gcc.godbolt.org/z/dY8bPhMYc=