http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53722
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 constructor. 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.