sure( my code wont work, it will produce an stack overflow in the compiler, because i call the operator+ in the operator+ function),
and maybe you have forgotten, that the operator ‘=’ must be overloaded too, in cases where the standard-constructor cannot solve the ‘=’ operation, maybe that is the problem ?
I didn’t mean you code won’t run but you’ll
have error in compiling instead of stack overflow. And have you tried my code, I really want to know whether is my compiler
or everyone’s compiler have that error.
Internal compiler errors, while often caused by your own code, can also mean that the compiler crashed on its own, due to some bug. So, make sure you’re up-to-date on all your service packs.
Also, the reason that your “WhatEver” example didn’t work the first time is because you should have declared the arguments to the + operator as const. You shouldn’t ever be changing them in +, so they should be const. If they were const, then the compiler wouldn’t have complained.
Originally posted by Questions Burner: It seem like it’s my compiler’s problem.
Thanks anyway.
Try adding a /Bd switch to the compiler command line. This causes the preprocessor and compile steps to happen as two seperate steps. Sometimes this will give you more information and sometimes, the crash just goes away.