c++gccvisual-c++

Unforgiving GCC C++ compiler


MS VS x86 compiler has no problem with the following definitions, but GCC (ARM) complains. Is GCC dumb or is MSVS_x86 too clever?

bool checkPointInside(const CIwVec2& globalPoint) {
    return checkPointIn(globalPoint, CIwVec2());
}; /// error: no matching function for call to 'Fair::Sprite::checkPointIn(const CIwVec2&, CIwVec2)'

bool checkPointIn(const CIwVec2& globalPoint, CIwVec2& localPoint) {
    return false;
}; 

Solution

  • According to the C++ standard, you cannot bind an rvalue to a non-const reference. The Microsoft compiler has an evil extension that allows this, however. So g++ is correct not to accept your program.