description | title | ms.date | f1_keywords | helpviewer_keywords | |||||
---|---|---|---|---|---|---|---|---|---|
Learn more about: /constexpr (Control constexpr evaluation) |
/constexpr (Control constexpr evaluation) |
04/14/2025 |
|
|
Use the /constexpr
compiler options to control parameters for constexpr
evaluation at compile time.
/constexpr:depth
N
/constexpr:backtrace
N
/constexpr:steps
N
depth
N
Limit the depth of recursive constexpr
function invocation to N levels. The default is 512.
backtrace
N
Show up to N constexpr
evaluations in diagnostics. The default is 10.
steps
N
Terminate constexpr
evaluation after N steps. The default is 100,000. A step refers to an individual computation taken towards evaluating the constant expression. Increasing the maximum number of steps might cause compilation to take longer in cases where compilation would otherwise fail.
The /constexpr
compiler options control compile-time evaluation of constexpr
expressions. Evaluation steps, recursion levels, and backtrace depth are controlled to prevent the compiler from spending too much time on constexpr
evaluation. For more information on the constexpr
language element, see constexpr
(C++).
The /constexpr
flag is available beginning in Visual Studio 2015.
- Open your project's Property Pages dialog box.
- Select the Configuration Properties > C/C++ > Command Line property page.
- Enter /constexpr compiler options in the Additional Options box. Choose OK to save your changes.
- See xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.AdditionalOptions%2A.