Mail Archives: djgpp/2003/05/17/16:18:07
Hi folks,
This is maybe a little bit frivolous...
A year or two ago, I was frustrated with GCC not being able to accept
a reference to a temporary object as a function argument, like this:
class UserType
{ // ...
// UserType operator+ (const UserType&);
// ...
};
void func (const UserType&);
int main ()
{ UserType a, b;
func (a+b);
// ...
}
I had learned C++ first in the early 1990s using Turbo C++, and I
remember using examples from Stroustrup's book that did things like
this without any trouble on that compiler.
When this issue arose for me (a year or two ago) I found that the
DJGPP compiler didn't like this sort of syntax, that it was a known
problem, and that the advice being given on this list was to create
one's own temporary (i.e., Usertype c=a+b;) as a workaround.
I was tinkering around today, and tried again. I notice that it is OK
now, no warnings or errors.
Was this a DJGPP issue? Or simply a GCC issue? Does anyone know when
it changed? (This is obviously an unimportant matter, but I am simply
curious.)
Dave W.
- Raw text -