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: an rvalue reference question


Hi Chih-Long,

> blah z((blah())); // expecting calling blah::blah() and blah::blah(blah&&) but
got only blah::blah()

C++ allows this to be optimized, by eliding the copy constructor.  This
optimization is in the ISO 14882 specification.

This C++ optimization will occur even if you¹ve disabled GCC¹s optimizations
(-O0).

Try this flag to disable the C++ optimization:  -fno-elide-constructors

HTH,
<Eljay


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]