From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 790E73856DD0; Tue, 15 Aug 2023 19:00:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 790E73856DD0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692126015; bh=/RpFIF0VtKRJpoVzy7haYGOjgbW13UWxw0NJum35YNg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=LITmWYhTwSwZobNntYBvEM61xXGsnpFiirgtmRF/Y3Rfrh1+kZPqHBg3tkkop1mPb RwD2En6wWUlWPivjoJWYyTLdYuW2zj1PEj1FxjC9BrTC8WRDO7u5OY28YJpCXvIWCO meGjR15U5WuZl2F+Ct8pERx1KZSC6Mpho1Z8M4N4= From: "yagreg7 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/99232] Exported variable in module gives error: 'lambda' was not declared in this scope Date: Tue, 15 Aug 2023 19:00:14 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: yagreg7 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: cc Message-ID: In-Reply-To: References: 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=3D99232 Gregory Dushkin changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |yagreg7 at gmail dot com --- Comment #1 from Gregory Dushkin --- The issue is still present in GCC 13.2.1 and appears to only affect the act= ual variables but not references to them. E.g. the code: ``` // test.cc export module test; export constexpr int a =3D 42; // main.cc import test; int main() { return a; } ``` would give: ``` $ g++ test.cc -std=3Dc++20 -fmodules-ts -c $ g++ main.cc -std=3Dc++20 -fmodules-ts -c main.cc: In function =E2=80=98int main()=E2=80=99: main.cc:4:12: error: =E2=80=98a=E2=80=99 was not declared in this scope 4 | return a; | ``` but ``` // test.cc export module test; export constexpr int a_ =3D 42; export constexpr const int& a =3D a_; // main.cc import test; int main() { return a; } ``` compiles successfully using the same commands.=