https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81051
Bug ID: 81051 Summary: lambda capture of this in initialization list with virtual inheritance Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: dje at gcc dot gnu.org Target Milestone: --- [Reported on Stackoverflow https://stackoverflow.com/questions/43748646/gcc-bug-with-lambda-capture-of-this-in-initialization-list-with-virtual-inherita] The following code segfaults under gcc-4.9, 5.4, and 6.3 with std=c++11, but compiles and runs fine under clang-3.7, and VS2015 Update 3. C++14 12.7.3 is fairly explicit that this should be allowed. struct A { int Func() { return x++; } int x = 5; }; struct B { B(int) {} }; struct Derived : public virtual A, public B { Derived() : A() // , B(this->Func()) // This works! , B([this](){ return this->Func(); }()) // But this segfaults. { } }; int main() { Derived c; }