Copy constructor: is this a bug?
me22
me22.ca@gmail.com
Sun Nov 1 04:06:00 GMT 2009
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
More information about the Gcc-help
mailing list