https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79104
Jason Merrill <jason at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P3 Status|ASSIGNED |NEW Summary|[7 Regression] ambiguity |[DR 696] wrong semantics |calling std::begin on a |for odr-use of constant |local constexpr array of |variable from lambda |structs | --- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> --- The handling of this testcase went from wrong-code to rejects-valid, so I don't think it qualifies as a regression. The issue here is that we don't implement DR 696 properly; we should capture a, but instead replace it with its initial value. Given that, r240819 changed this to be correctly rejected; a temporary should not bind to a non-const reference. Here's a simpler testcase to illustrate our non-conformance on DR 696: void f () { const int i = 42; [&]() { &i; // OK, captures i }; }