Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning with gcc 8.1 [-Wclass-memaccess] #1246

Closed
youtingxia opened this issue May 10, 2018 · 1 comment
Closed

Warning with gcc 8.1 [-Wclass-memaccess] #1246

youtingxia opened this issue May 10, 2018 · 1 comment

Comments

@youtingxia
Copy link

@youtingxia youtingxia commented May 10, 2018

g++ 8.1.0 (on CentOS 6.9), RapidJSON v1.1.0
rapidjson/document.h:1989:24: warning:‘void* memcpy(void*, const void*, size_t)’ writing to an object of type ‘class rapidjson::GenericValue<rapidjson::UTF8<> >’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
std::memcpy(e, values, count * sizeof(GenericValue));
~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rapidjson/document.h:548:7: ‘class rapidjson::GenericValue<rapidjson::UTF8<> >’ declared here
class GenericValue {

@janisozaur
Copy link

@janisozaur janisozaur commented May 10, 2018

Duplicate of #1205

pah added a commit to pah/rapidjson-upstream that referenced this issue Jul 15, 2018
Recent GCC versions warn about using memcpy/memmove to
write to a class pointer (-Wclass-memaccess).

Avoid the warnings by casting to void* first.

Closes Tencent#1086.
Closes Tencent#1205.
Closes Tencent#1246.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants