Closed Bug 1411584 Opened 7 years ago Closed 7 years ago

-Wclass-memaccess: clearing an object of non-trivial type 'struct mozilla::dom::GamepadPoseState';

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox58 --- fixed

People

(Reporter: Sylvestre, Assigned: andi)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

/root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/dom/GamepadPoseState.h: In member function 'void mozilla::dom::GamepadPoseState::Clear()':
 /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/dom/GamepadPoseState.h:85:45: error: 'void* memset(void*, int, size_t)' clearing an object of non-trivial type 'struct mozilla::dom::GamepadPoseState'; use assignment or value-initialization instead [-Werror=class-memaccess]
      memset(this, 0, sizeof(GamepadPoseState));
Depends on: 1411625
No longer depends on: 1411625
This is a good catch, since we need to have this landed: 525063
Assignee: nobody → bpostelnicu
Comment on attachment 8922232 [details]
Bug 1411584 - avoid using memset on a non-trivial type object.

https://reviewboard.mozilla.org/r/193260/#review198750

I believe the intention here was for this to be a POD type, but perhaps it is being promoted to non-trivial due to the constructor.

Perhaps we could do some static asserts in the future where we depend on something being a POD to catch these.
Attachment #8922232 - Flags: review?(kgilbert) → review+
Pushed by bpostelnicu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/907068074409
avoid using memset on a non-trivial type object. r=kip
https://hg.mozilla.org/mozilla-central/rev/907068074409
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: