[Bug libstdc++/54259] New: Regression in move construction for std::pair
oleg at smolsky dot net
gcc-bugzilla@gcc.gnu.org
Tue Aug 14 16:26:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54259
Bug #: 54259
Summary: Regression in move construction for std::pair
Classification: Unclassified
Product: gcc
Version: 4.7.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: oleg@smolsky.net
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.
I have a templated class LockGuard that is move-constructable and not copyable.
This is accomplished (in the conventional C++98 way) by making the copy
constructor "private". The code creates an instance of std::pair<...,
LockGuard<...>> and returns it to the caller.
The code compiles and runs on g++ 4.6.3 and VS2010/sp1, yet g++ 4.7.1 emits a
bunch of errors (below). The point, as far as I can tell, is that it wants to
call the copy constructor which is private. I can fix the issue by explicitly
removing the copy constructor:
LockGuard(const LockGuard &) = delete;
Could someone clarify if this behavior is conforming to the standard? Normally
I would not worry about such a thing, but VS2010 does not understand "= delete"
specs and the behavior appears to be a breaking change w.r.t. copy constructor
invocations... (well, breaking is too strong a word as move constructors and
rvalue references are new, but I am sure you see what I mean)
More information about the Gcc-bugs
mailing list