Re: Copy constructor: is this a bug?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2009/10/31 Michael Tsang <miklcct@xxxxxxxxx>:
>
>        Test(const Test &x): count(x.count+1) {
>        }
>
> Actual result:
>
> 0
> 0
> 0
>

Looks like legit copy constructor elision to me.  This is a good thing
for anything with value-semantic copy constructors (as they all should
be), but if you have classes that do strange things (like your
example), check out -fno-elide-constructors


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux