I just spent an inordinate amount of time fiddling with a complilation error in Visual Studio. I have distilled the code into the small compilable example below and tried it
You must be facing a compiler bug. The standard says that B
gets an implicitly declared and defined move constructor; all the conditions of 12.8(9) are met (i.e. B
does not have an explicitly declared copy constructor, copy-assignment, etc, and the move constructor would not implicitly be declared deleted
).
If you are using Visual Studio 2010 or 2012, be advised: the compiler does not automatically generate move constructors for you. That wasn't implemented. So you need to write them yourself.