https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86926
Bug ID: 86926 Summary: [Regression] ICE for a recursive generic lambda Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: v.reshetnikov at gmail dot com Target Milestone: --- /************************* BEGIN SOURCE *************************/ int main() { constexpr auto f = [](auto self, auto n) { if(n < 2) return n; return self(self, n - 1) + self(self, n - 2); }; constexpr auto fibonacci = [=](auto n) { return f(f, n); }; static_assert(fibonacci(7) == 13); } /************************** END SOURCE **************************/ Compile with -std=c++17. EXPECTED: no errors. ACTUAL: <source>: In instantiation of 'main()::<lambda(auto:3)> [with auto:3 = int]': <source>:11:30: required from here <source>:9:54: internal compiler error: in build_over_call, at cp/call.c:8214 9 | constexpr auto fibonacci = [=](auto n) { return f(f, n); }; | ~^~~~~~ Tested with build 9.0.0 20180810 (experimental), appears to be a regression from GCC 8.2. For comparison, the code also successfully compiles with Clang.