[Bug c++/82562] Incorrect warning: use copy-assignment or copy-initialization instead when copying build objects.
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Oct 16 11:26:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82562
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
Last reconfirmed| |2017-10-16
Ever confirmed|0 |1
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Andi from comment #0)
> In file included from /root/firefox-gcc-last/js/src/builtin/RegExp.cpp:24:0:
> /root/firefox-gcc-last/js/src/vm/NativeObject-inl.h: In member function
> 'void js::NativeObject::initDenseElements(const JS::Value*, uint32_t)':
> /root/firefox-gcc-last/js/src/vm/NativeObject-inl.h:184:52: error: 'void*
> memcpy(void*, const void*, size_t)' writing to an object of non-trivially
> copyable type 'class js::HeapSlot'; use copy-assignment or
> copy-initialization instead [-Werror=class-memaccess]
> memcpy(elements_, src, count * sizeof(HeapSlot));
>
> I don't think that the warning is valid since what we try to do is copy in
> eleements_ the number of 'count' elements of type HeadSlop from src.
Why would that mean it's not valid? Is the class trivially-copyable or not? If
it isn't, then using memcpy is undefined.
Please read https://gcc.gnu.org/bugs/ and provide the preprocessed code.
More information about the Gcc-bugs
mailing list