By default, C/C++test will not apply code instrumentation to 'constexpr' functions. As a result, the following limitations will be imposed:

The limitations apply also to the following cases:

Collecting Code Coverage for C++ 'constexpr' Functions

C/C++test can collect code coverage for 'constexpr' functions executed during run-time. No coverage will be reported for a 'constexpr' function used only at compilation time.

Note: A 'constexpr' function called from a unit test case will be executed during run-time, so code coverage will be collected for it.

Enabling Code Coverage for 'constexpr' Functions

Follow these steps to enable collecting coverage for 'constexpr' functions:

  1. Open the test configuration and go to the Execution > General tab.
  2. In Execution details, click Edit in the Instrumentation mode section.
  3. Go to the Test Configuration's Execution tab Instrumentation features panel, and enable the Enable coverage for constexpr function option in the Advanced options section.

Supported Compilers 

Collecting code coverage for C++ 'constexpr' functions is supported for the following compilers:

This feature requires that the compiler provides the '__builtin_is_constant_evaluated()' built-in function.

The following known limitations apply to compiler usage: