[Bug c++/28761] Returning object ignores copy constructor
pluto at agmk dot net
Thu Aug 17 14:11:00 GMT 2006
------- Comment #6 from pluto at agmk dot net 2006-08-17 14:11 -------
(In reply to comment #5)
> I meant the copy ctor, not the dtor.
> Anyhow, looking at it again, it makes some sense.
"When certain criteria are met, an implementation is allowed to omit the copy
construction of a class object, even if the copy constructor and/or
destructor for the object have side effects.
In such cases, the implementation treats the source and target
of the omitted copy operation as simply two different ways of referring
to the same object"
you can disable such optimization with -fno-elide-contructors
More information about the Gcc-bugs