This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118b. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-09-28


3034. Infinite recursion should hit an implementation limit

Section: 13.9.2  [temp.inst]     Status: open     Submitter: Timur Doumler     Date: 2025-07-04

Infinite recursion during template instantiation is specified to yield undefined behavior in 13.9.2 [temp.inst] paragraph 16. However, instantiation should be subject to compile-time implementation limits and not cause runtime undefined behavior.

Suggested resolution:

Change in 13.9.2 [temp.inst] paragraph 16 as follows:

There is an implementation-defined quantity that specifies the limit on the total depth of recursive instantiations (Clause Annex B [implimits]), which could involve more than one template. The result of an infinite recursion in instantiation is undefined.