Functions with Specifier constexpr

C++ functions with the specifier constexpr are not instrumented by Testwell CTC++. In general, this is not possible as the instrumentation would destroy key properties of these functions and their return values.

The meaning of constexpr and the restrictions for functions to qualify for this specifier evolve with C++ standards. On a general level, constexpr indicates that the compiler may execute some of the function calls during compilation. From ctc's point of view, the following properties contradict an instrumentation:
  1. The result of calls during compilation can be used as compile-time constant, for example to size an array.
  2. The function must have at least one execution path that can be evaluated at compile time, i.e., without side effects.

When instrumenting code, ctc adds counters and increments them during execution. This would violate property 2, leading to a compiler error. Even more fundamental, no compile-time evaluation would be possible with the instrumented version of the function.