/constexpr (Control constexpr evaluation)

Use the /constexpr compiler options to control parameters for constexpr evaluation at compile time.


/constexpr:depthN /constexpr:backtraceN /constexpr:stepsN


depthN Limit the depth of recursive constexpr function invocation to N levels. The default is 512.

backtraceN Show up to N constexpr evaluations in diagnostics. The default is 10.

stepsN Terminate constexpr evaluation after N steps. The default is 100,000.


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 options are available beginning in Visual Studio 2015.

To set this compiler option in the Visual Studio development environment

  1. Open your project's Property Pages dialog box.

  2. Under Configuration Properties, expand the C/C++ folder and choose the Command Line property page.

  3. Enter any /constexpr compiler options in the Additional Options box. Choose OK or Apply to save your changes.

To set this compiler option programmatically

See also

MSVC Compiler Options
MSVC Compiler Command-Line Syntax