This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

gcc-3.0: Obvious infinite recursion not detected


The sample below compiles well (g++ -Wall) without any warning.
The call of operator == leads to an infinite recursion,
but the compiler does not warn.

class X {};
 
bool operator==(const X& lhs, const X& rhs)
{
  return lhs == rhs;
}
 
int main()
{
  X l;
  X r;
  l == r;
} 


Regards
-- 
Ryszard Kabatek


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]