https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96184
Andrew Pinski <pinskia at gcc dot gnu.org> 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 <pinskia at gcc dot gnu.org> --- So I think it is legal because if we have: int main(){ int a = 10; int const b = 10; static constexpr int d = b ? 0 : a = b; auto p1 = [ ] () noexcept ( d) { return d;}; return d; } the d is a constexpr at this point and a valid one and was even accepted before in GCC 8.5.0. So this is only a regression in GCC 9 and GCC 10.