G++: Non-const copy ctor sometimes ignored
Chip Salzenberg
chip@valinux.com
Sun Feb 27 16:09:00 GMT 2000
According to Martin v. Loewis:
> No, it's a bug in the code.
!
> Returning from a function is copy-initialization, not
> direct-initialization.
!!
> You cannot initialize the return value, because the temporary B object
> cannot be bound to a reference, and because there is no implicit
> B(const B&) copy ctor.
Do you mean, 'The temporary B object cannot be bound to a *non-const*
reference'? That would make more sense in context, I think.
> Welcome to C++,
> Martin
!!!
Just when I thought I understood C++, it goes and surprises me again.
Thanks very much for the clear explanation. <-- understatement
--
Chip Salzenberg - a.k.a. - <chip@valinux.com>
"I wanted to play hopscotch with the impenetrable mystery of existence,
but he stepped in a wormhole and had to go in early." // MST3K
More information about the Gcc-bugs
mailing list