What is the reason for this?
const int a = 0;
static int b = a * 5;  // compile error
int main()
{
    const int x = 1;
    static int y = x * 10;  // compile error
}
What is the reason for this?
const int a = 0;
static int b = a * 5;  // compile error
int main()
{
    const int x = 1;
    static int y = x * 10;  // compile error
}
 
    
    According to C standard:
All the expressions in an initializer for an object that has static or thread storage duration shall be constant expressions or string literals.
This is valid C++ code though.
