Consider
fc(4) should be evaluated at compile time because the argument to fc is known at compile time. However fc(c) will be evaluated at run-time.
What would be nice is if there is a way to produce a compiler warning when a function defined as constexpr is not able to be evaluated at compile-time but is evaluated at run-time. Is this possible somehow?
Code:
constexpr int fc(int i)
{
return i * 3;
}
....
fc(4);
int c = 8;
fc(c);
What would be nice is if there is a way to produce a compiler warning when a function defined as constexpr is not able to be evaluated at compile-time but is evaluated at run-time. Is this possible somehow?