https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118349
Bug ID: 118349
Summary: Suggestion for new warning: -Wtemplate-depth= (like
-ftemplate-depth= but a warning instead of an error)
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: enhancement
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: egallager at gcc dot gnu.org
Blocks: 87403
Target Milestone: ---
g++ currently has a flag, -ftemplate-depth=, to control the maximum
instantiation depth for template classes. The behavior when this depth is
exceeded is to emit an error. However, it might be nice to also be able to get
a warning when a different depth is reached, so that users can have both a soft
limit and a hard limit. For example, one could do -Wtemplate-depth=17
-ftemplate-depth=1024 to get a warning when the pre-C++11 limit is reached, but
only actually fail if the post-C++11 limit is reached. This would be a more
targeted version of the -Wtemplates warning flag (which warns on any template
usage at all), for users who are okay with template usage, but just don't want
it to get out of hand.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87403
[Bug 87403] [Meta-bug] Issues that suggest a new warning