FIXED. Compiler Bug?

 

A careless substitution resulted in code that I was able to reduce to this:

  void Test() {
    bool b;
    b[  = true;
    if (b[) {
      b[ = false;
    }
  }

1. the code is compiled without errors.
2. it is executed without error.
3. in the debugger after the assignment b[ is displayed as true.
4. the "if" on the other hand is never entered.

In my original EA code, this proved to be a killer. It gave completely different results... because the "if" never occurred.
Am I missing something here? Is there a mysterious [-operator or is this just a bug?

Version: Metaeditor 5.0, build 3550, 16.12.2022
 

malumuc: A careless substitution resulted in code that I was able to reduce to this:

void Test() {
   bool b;
   b[  = true;
   if (b[) {
     b[ = false;
   }
 }

1. the code is compiled without errors.
2. it is executed without error.
3. in the debugger after the assignment b[ is displayed as true.
4. the "if" on the other hand is never entered.

In my original EA code, this proved to be a killer. It gave completely different results... because the "if" never occurred.
Am I missing something here? Is there a mysterious [-operator or is this just a bug?

Version: Metaeditor 5.0, build 3550, 16.12.2022

Very strange indeed. It seems to be a bug in the MetaEditor at the very least.

However, please edit your original post and replace your code properly (with "</>" or Alt-S), for easier viewing (as I have done above in quoting your post).

 
  1. malumuc: 1. the code is compiled without errors.
    Not on MT4 (build 1370) (editor build 2402)
     void Test() {
        bool b;
        b[  = true;    // '[' - array required      testscr.mq4     858     6
                       // expression has no effect  testscr.mq4     858     5
        if (b[) {
          b[ = false;
        }
      }                // '}' - unexpected end of program   testscr.mq4     863     3
    

  2. Please edit your (original) post and use the CODE button (or Alt+S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum (2019)
              Messages Editor

 
@William Roeder #: Not on MT4 (build 1370) (editor build 2402)

Yes, but on MQL5 (MetaEditor 5 build 3550) it compiles without errors or warnings ...


 
Reported as fixed. Will be available in future build.
 
Alain Verleyen #:
Reported as fixed. Will be available in future build.
Fixed in Build 3630.