When compiling C++ inline recursive template functions, compiler halts with error: "Fatal Error C1002: compiler is out of heap space in pass 2". This happens even with Minimize Size (/O1) flag set. This does not happen if inlining is disabled (/Ob0) or if function is __declspec(noinline).As inline is a hint, the compiler should ignore it when inlining would be silly. A solution would be to measure how long a function is before any inlining, and stop inlining functions more than 2 opcodes after the function has grown more than 10-15 times it's original size.
Visual Studio/Team Foundation Server/.NET Framework Tooling version
Steps to reproduce
Product Language
Operating System
Operating System Language
Actual results
Expected results
Please wait...