constexpr guaranteed only at compilation, if necessary at compile time. For example, this ensures that it will be computed at compile time, because enum values must be constant:
enum { VALUE = factorial(X) }; cout << VALUE << endl;
In any case, when it is not needed at compile time, it has the same effect as the inline declaration: it is just a hint, and the compiler can do whatever it wants.
Like inline , most compilers currently completely ignore your hint. For performance reasons, the compiler wants to be able to embed things even when you haven’t requested them, and has its own algorithm to determine when it’s not worth it, so why not take a look at the inline keyword?
source share