This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: error: no matching function for call to `Anton::Anton(Anton)`
> 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.