Defining a function before a class makes the class undefined? (MWE provided)

In ArduinoIDE 1.8.12 this code will Verify successfully:

struct myINT {
  int i;
};

myINT makeINT() { return myINT{5}; }

void setup() {}
void loop() {}

…no surprise, right? However this won’t:

int two() { return 2; }

struct myINT {
  int i;
};

myINT makeINT() { return myINT{5}; } // <-- error: 'myINT' does not name a type

void setup() {}
void loop() {}

It will compile again if the definition of two() is moved after the one of myINT.

Is this behavior expected?

Found this: https://forum.arduino.cc/index.php?topic=579974.0

I can't believe it! Why breaking C++ in such silly ways?
I am developing some adversion towards this Arduino "language".

dariop:
Found this: https://forum.arduino.cc/index.php?topic=579974.0

I can't believe it! Why breaking C++ in such silly ways?
I am developing some adversion towards this Arduino "language".

Then use a different open source toolchain. They did this stuff to make it easier for beginners to program.

Yeah, but they make the life of expert C++ programmers a nightmare. I basically lost one entire day on this, trying to narrow down a fairly large project.

aarg:
a different open source toolchain

Any recommendation? (Linux)

I don't know, it's on my to-do list. Maybe Eclipse has a plugin. I believe you can avoid the automatic prototyping by placing your code in a .cpp instead of .ino file:
https://www.gammon.com.au/forum/?id=12625