[patch libstdc++] Fix assignability check in uninitialized_copy
Eelis
eelis@eelis.net
Sun Dec 28 12:47:00 GMT 2014
On 2014-12-28 00:18, Eelis wrote:
> Trivial fix attached.
Please don't commit this patch.
I just noticed that the assignability test is wrong in an additional way: it should look at assignability of /output/ elements, not /input/ elements.
As a result, this code is currently rejected (because uninitialized_copy doesn't notice in time that chars can't be assigned to Xs):
struct X
{
X() = default;
X(char) {}
X(X const &) = default;
X & operator=(X const&) = default;
X & operator=(char) = delete;
};
#include <memory>
int main()
{
char a[100];
X b[100];
std::uninitialized_copy(a, a+10, b);
}
Updated fix attached. With it, the code is accepted again. Testing as we speak.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-uninitialized-copy-assignability-check.patch
Type: text/x-patch
Size: 1374 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20141228/d992502e/attachment.bin>
More information about the Libstdc++
mailing list