Constant-folding is a popular technique used by optimizing compilers to reduce the amount of computation performed at runtime.

C++20 introduced bool std::is_constant_evaluated() function in its standard library.