error: no matching function for call to `Anton::Anton(Anton)`

e.karge e.karge@struction.de
Fri Oct 10 14:36:00 GMT 2003


> Hi Eric,
>
> As per section 5.5 of Stroustrup's C++PL (3rd ed or special ed), a
> temporary object cannot be bound to a non-const reference.
>
> What you are trying to do is to bind a temporary object to a non-const
> reference.  That's not allowed by C++.
>
> (For the reasons that it's not allowed, see C++PL.)
>
> Change your pass-by-reference to a pass-by-value, then your program will
> compile.
>
> Or make an explicit variable instead of using a temporary.
> HTH,
> --Eljay

This works fine, thanks a lot for help,
Eric.



More information about the Gcc-help mailing list