Purpose
Specifies the maximum number of recursively
instantiated template specializations that will be processed by the
compiler.
Syntax
>>- -q--templatedepth--=--number-------------------------------><
Defaults
-qtemplatedepth=300
Parameters
- number
- The maximum number of recursive template instantiations. The number
can be a value between 1 and INT_MAX. If your code attempts to recursively
instantiate more templates than number, compilation halts and
an error message is issued. If you specify an invalid value, the default
value of 300 is used.
Usage
Note that setting this option to
a high value can potentially cause an out-of-memory error due to the
complexity and amount of code generated.
Examples
To allow the following code in
myprogram.cpp to
be compiled successfully:
template <int n> void foo() {
foo<n-1>();
}
template <> void foo<0>() {}
int main() {
foo<400>();
}
Enter:
xlc++ myprogram.cpp -qtemplatedepth=400