On May 7, 4:25=A0pm, "Victor Bazarov" <v.Abaza...@[EMAIL PROTECTED]
> wrote:
> Branimir Maksimovic wrote:
> > It will call copy constructor all right, but
> > still gives error that it wants A(A)
>
> Sorry, I don't know what you mean here.
>
I had to wait several hours to be sure that this is
not already sent, because I clicked send twice
but google didn't confirmed.
Ok, following program does not compiles:
class A{
public:
A(){}
A(A&){}
};
A foo()
{
A a;
return a;
}
int main()
{
A a;
a =3D foo();
}
bmaxa@[EMAIL PROTECTED]
g++ -Wall cctor.cpp -o cctor
cctor.cpp: In function =91int main()=92:
cctor.cpp:16: error: no matching function for call to =91A::A(A)=92
cctor.cpp:4: note: candidates are: A::A(A&)
Since tem****ary is constructed by local variable now, I think
that this should compile since A::A(A&) should be called.
But I got same error again.
That is what confuses me. Is compiler right or should
this compile?
Thanks for your time (I'm really rusty with English language)
Greetings, Branimir.


|