https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83441
Boldizsar Palotas <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |boldizsar.palotas@continent | |al-corporation.com --- Comment #1 from Boldizsar Palotas <[email protected]> --- A more minimal reproduction that relies on the core language only: // https://godbolt.org/z/fW6Bkx #include <cassert> template <class X> struct S { S* x = [this] { return this; }(); }; int main() { S<int> s; assert(s.x != nullptr); } The assert fails only on GCC 7, including GCC 7.4 and 7.5. Other compilers and newer GCC major versions seem fine. More combinations can be tested on the Compiler Explorer link.
