https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95451
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- We indeed ICE on: struct A { template<typename> void foo() { [this](auto) { operator()(); }(0); } void operator()() {} }; int main() { A{}.foo<void>(); } accept: struct A { template<typename> void foo() { [this](int) { operator()(); }(0); } void operator()() {} }; int main() { A{}.foo<int>(); } and reject: struct A { void foo() { [this](auto) { operator()(); }(0); } void operator()() {} }; int main() { A{}.foo(); } while clang++ accepts all 3. With this->operator()() instead of operator()() all 3 are accepted too indeed.