On 2012-08-14 08:06, Marc Glisse wrote:
On Tue, 14 Aug 2012, Oleg Smolsky wrote:
Hey all, I've just attempted to move my project from g++ v4.6.3 to
v4.7.1 and hit an issue when using move semantics.
[...]
How about including a minimal testcase with your post?
That's very easy - in 42 lines :) Please see the attachment.
Oleg.
#include <memory>
namespace
{
template <class Type>
class LockGuard
{
public:
LockGuard(Type &) {
}
// LockGuard(const LockGuard &) = delete;
LockGuard(LockGuard &&) {
}
private:
LockGuard(const LockGuard &);
};
struct Lock
{
LockGuard<Lock> Hold() {
return LockGuard<Lock>(*this);
}
};
struct Data
{
} _data;
Lock _lock;
std::pair<Data *, LockGuard<Lock>> lock_me() {
return std::make_pair(&_data, _lock.Hold());
}
}
int main(int argc, char *argv[])
{
auto x = lock_me();
return 0;
}