[Is this a bug?] Order of initialization

 

Is it normal? Or is it a bug?

const int GLOBAL = 1;

class CTest
  {
private:
   static const int MEMBER;
public:
   static void method();
  };

const int CTest::MEMBER = 1;

void CTest::method(void)
  {
   int arrOk[3]     = {1 + 2, 1 + 3, 1 + 4};                // OK
   int arrNotOk1[3] = {GLOBAL + 2, GLOBAL + 3, GLOBAL + 4}; // '+' - constant expression required
   int arrNotOk2[3] = {MEMBER + 2, MEMBER + 3, MEMBER + 4}; // '+' - constant expression required
  }
 
Vladislav Boyko:Is it normal? Or is it a bug?

Don't confuse "variable constants" with "constants/literals". They are not the same thing.

In this case, what the compiler is expecting is "constants/literals" so as to be able to resolve the expression at compile-time.

 

Works with built-in constants (MQL4):

//...
int arrOk2[3] = {OP_SELL + 2, OP_SELL + 3, OP_SELL + 4}; // OK
//...
Fernando Carreiro #: Don't confuse "variable constants" with "constants/literals". They are not the same thing. In this case, what the compiler is expecting is "constants/literals" so as to be able to resolve the expression at compile-time.

I'm understood, thank you

Reason: