From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 45B123858D39; Fri, 10 Sep 2021 06:56:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 45B123858D39 From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/96184] [9/10 Regression] GCC treats "use of local variable with automatic storage from containing function" differently in versions Date: Fri, 10 Sep 2021 06:56:08 +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: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 9.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status keywords everconfirmed short_desc target_milestone cf_reconfirmed_on 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 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: Fri, 10 Sep 2021 06:56:11 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96184 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Keywords| |rejects-valid Ever confirmed|0 |1 Summary|GCC treats "use of local |[9/10 Regression] GCC |variable with automatic |treats "use of local |storage from containing |variable with automatic |function" differently in |storage from containing |versions |function" differently in | |versions Target Milestone|--- |9.5 Last reconfirmed| |2021-09-10 --- Comment #3 from Andrew Pinski --- So I think it is legal because if we have: int main(){ int a =3D 10; int const b =3D 10; static constexpr int d =3D b ? 0 : a =3D b; auto p1 =3D [ ] () noexcept ( d) { return d;}; return d; } the d is a constexpr at this point and a valid one and was even accepted be= fore in GCC 8.5.0. So this is only a regression in GCC 9 and GCC 10.=