If what you want is to differentiate between a compile time constant and a non-compile time constant - then you have no chance. That's not possible.
But if you want to differentiate between a non-constant variable and between a constant variable (and everything else included - like literals), then you can overload a function with a const-reference and non-const reference parameter. For this scenario, the C++ Standard introduces extra rules that make this otherwise ambiguous case not ambiguous.
void f(int const&); // #1
void f(int&); // #2
In this matter, the following decisions are done
int x = 0;
int const y = x;
int const z = 1;
f(1); // #1
f(x); // #2
f(y); // #1
f(z); // #1
Note how it can't differentiate between y and z, even though value of z is a compile time constant (termed integral constant expression, or ICE), while y is not.
What you can do is to only accept compile time values then. Overload the function so that one is a template and the other isn't
template<int N> void f(); // #1
void f(int n); // #2
It behaves like this then:
int x = 0;
int const y = x;
int const z = 1;
f<1>(); // #1
f(1); // #2
f<y>(); // error, y not an ICE
f<z>(); // #1
f(x); // #2
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…