The problem is the opposite: the MinGW compilers are LESS compliant with C++ standards than the older GCC compiler.
Under every C++ standard going back to 98, the compiler should at least warn that "ISO C++ forbids declaration of [function] with no type". GCC 4.8.4 warns on declaration of main with no type but defaults to int and compiles. But it errors on declaration of any other function with no type and refuses to compile. And the "missing field initializers" warning should be given under -std=c++11 or later.
All 3 of these MinGW compilers compile the code with no errors, no warnings.
Here's an even simpler version of the program. It doesn't use std::array but should still produce the same error and warning messages. But the MinGW compilers build it with no errrors or warnings at all.
#include <iostream>
struct array5 {
int nums[5];
int& operator[](int idx) {
return nums[idx];
}
int const& operator[](int idx) const{
return nums[idx];
}
};
getSum(array5 arr) // no return type ERROR
{
int sumIt(0);
int sz = 5;
for(int i = 0; i < sz; i++)
sumIt += arr[i];
return sumIt;
}
main() // no return type WARNING
{
array5 myInts{}; // missing field initializers WARNING
for(int i = 0; i < 5; i++) {
myInts[i] = i+90;
}
std::cout << getSum(myInts) << std::endl;
return (0);
}
Edited to add this code.