https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97790
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The lambda, or templates aren't needed for that. struct S { int *d; int n; constexpr S () : d(new int[1]{}), n(1) {} constexpr ~S () { delete [] d; } }; constexpr S foo () { return S (); } constexpr int bar () { return foo ().n; } constexpr int baz () { return S ().n; } constexpr int a = baz (); constexpr int b = bar ();