You are right that the value of the variable "a" in your example in known at compile time. Indeed, "10" is a constant expression (otherwise const int a = 10 or constexpr int a = 10 wouldn't compile).
However, your variable "a" is not a constant expression as the language sees it. Yes, the compiler can probably optimize your code such that when you reference "a" in your code, it can substitute that with 10. But for things in the language that require a compile-time expression, it will not do. That's the way the language works.
So in order to tell the compiler that this is indeed a compile-time expression (i.e. an expression that the compiler knows when compiling the code), then you should mark the variable with "constexpr." Btw, constexpr works for functions too, allowing you to run a function at compile time. Consider:
Code:
constexpr int max(int a, int b) { return (a >= b ? a : b); }
constexpr int m = max(5, 10);
The function is run by the compiler when compiling the code and the result 10 will be stored in your constant expression variable m.