I have C++14 enabled in code (a Qt5 project) similar to the following:
auto func = [&](auto p, auto pp) {
if(!p)
return;
pp = p;
p->init();
this->member_function(pp->thing()); // replaces member_function(pp->thing());
};
MyClass *p1;
...
func(p1, m_p);
m_p->doSomething();
After receiving:
internal compiler error: Segmentation fault
Debugging I found m_p
did not change after the call to func
, as I was expecting. Does generic lambda (auto
) really works so? How do I go to change m_p
in code like the above?
File a bug report in gcc's bugzilla. Whether your code is valid C++, or not, the compiler should not blow up with a segmentation fault.
Segmentation fault in the compiler is very bad, but have you tried using auto& pp
? It looks like m_p
is being passed by value, not reference.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With