Is this a compiler bug? array init

This is not my code but something I started playing around with in a search for a solution to my array of pointers to function. The following compiles without errors. Scroll down for the second version which IMOSHO should also compile but doesn't

typedef void (* GenericFP)(int); //function pointer prototype to a function which takes an 'int' an returns 'void'

GenericFP MenuFP[3] = {&Page1, &Page2, &Page3}; //create an array of 'GenericFP' function pointers. Notice the '&' operator

void setup()
{
  Serial.begin(115200);
}

void loop()
{
  MenuFP[0](1); //call MenuFP element 0 with the parameter 1.  This is equivalent to: Page1(1)
  MenuFP[1](5); //call MenuFP element 1 with the parameter 5.  This is equivalent to: Page2(5)
  MenuFP[2](7); //and so on.                                   This is equivalent to: Page3(7)
}

void Page1(int foo)
{
  Serial.print("Page1=");
  Serial.println(foo);
}

void Page2(int foo)
{
  Serial.print("Page2=");
  Serial.println(foo);
}

void Page3(int foo)
{
  Serial.print("Page3=");
  Serial.println(foo);
}  

----------------------------second version----------------------------------------------------

typedef void (* GenericFP)(int); //function pointer prototype to a function which takes an 'int' an returns 'void'

GenericFP MenuFP[3] = {&Page1, 
&Page2, &Page3}; //create an array of 'GenericFP' function pointers. Notice the '&' operator

void setup()
{
  Serial.begin(115200);
}

void loop()
{
  MenuFP[0](1); //call MenuFP element 0 with the parameter 1.  This is equivalent to: Page1(1)
  MenuFP[1](5); //call MenuFP element 1 with the parameter 5.  This is equivalent to: Page2(5)
  MenuFP[2](7); //and so on.                                   This is equivalent to: Page3(7)
}

void Page1(int foo)
{
  Serial.print("Page1=");
  Serial.println(foo);
}

void Page2(int foo)
{
  Serial.print("Page2=");
  Serial.println(foo);
}

void Page3(int foo)
{
  Serial.print("Page3=");
  Serial.println(foo);
}

The only difference is the MenuFP array initialization. I put a new-line between &Page1 and &Page2. My understanding is this should be considered "white space".

Compiled fine for me... no errors or warnings. What do you get?

Maybe restart the IDE?

Yes this is a correct assumption.

The functions being defined afterwards is actually an error in c++ but the IDE tries to fix this by injecting forward declarations at the beginning of your ino file for you. Best would be to either define the functions before the array or at least provide the forward declaration yourself

@claude_j_greengrass , please show whole error message in the forum

Second sketch compiles and runs fine, if there is a bug then it is with your IDE parsing

I second this

Restarted IDE. bug went away. Sorry for the false negative.