constexpr function parameters are not implicitly constexpr, nor can they be declared as constexpr. So, they can’t be used constant expressions within the function.

Note

If a constexpr function is used in non-constant-expression, we can pass normal arguments to them as shown below.

constexpr int min(int a, int b)
{
  return a < b ? a : b;
}
 
int arg{1}, arg2{2};
int value2{min(arg, arg2)}; // no complain
constexpr int value{min(arg, arg2)}; // fails to compile

The following will fail as we can’t use non-constexpr argument in constant expression.

constexpr void doSomething(int a)
{
    constexpr int value{a};
}

If we want to pass constant expressions are parameter, we can use non-type template parameters.

For example,

template <int N>
constexpr int identity()
{
    constexpr int value{N};
    return value;
}
 
std::cout << identity<1>();

References

  1. https://www.learncpp.com/cpp-tutorial/constexpr-functions-part-2/