[Bug c++/53722] [C++0x] Returning implicit conversion class with deleted copy constructor

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jun 19 14:51:00 GMT 2012


Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-06-19 14:51:10 UTC ---
To return it by value Locker must have an accessible copy constructor or move

The deleted copy constructor suppresses the implicit definition of a move
constructor, so the class cannot be copied or moved.

If you declare the copy constructor for Locker then the class has an accessible
copy constructor, so it compiles.

Copy elision means the copy constructor is not actually used, but if you
compile with -fno-elide-constructors you will get a linker error because the
copy ctor isn't defined.

More information about the Gcc-bugs mailing list