This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Copy constructor: is this a bug?


2009/10/31 Michael Tsang <miklcct@gmail.com>:
>
> Â Â Â Â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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]