[Bug c++/95451] New: [8/9/10 regression] ICE for lambda capturing this and calling operator()
max.kanold@nu-cost.com
gcc-bugzilla@gcc.gnu.org
Sun May 31 14:33:54 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95451
Bug ID: 95451
Summary: [8/9/10 regression] ICE for lambda capturing this and
calling operator()
Product: gcc
Version: 10.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: max.kanold@nu-cost.com
Target Milestone: ---
The following legal code will lead to an Internal Compiler Error, see
https://godbolt.org/z/PoyMEL
================================
struct A {
template<typename>
void function_with_lambda() {
[this](auto) {
/*this->*/operator()();
};
}
void operator()() {}
};
int main() {
A{}.function_with_lambda<void>();
}
================================
A simple workaround is explicitely adding "this->" before the function call.
This is familiar to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86594, where
the same workaround prevents the ICE.
More information about the Gcc-bugs
mailing list