Fix warnings "implicitly-declared Rect& Rect::operator=(const Rect&) is deprecated" from GCC 9
ClosedPublic

Authored by yurchor on Oct 24 2019, 5:08 PM.

Details

Summary
Test Plan

Compiles on my gcc 8.3.1. GCC 9 is not tested, the solution is stolen from Internet.

Diff Detail

Repository
R331 Kig
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 18170
Build 18188: arc lint + arc unit
yurchor created this revision.Oct 24 2019, 5:08 PM
Restricted Application added a project: KDE Edu. · View Herald TranscriptOct 24 2019, 5:08 PM
Restricted Application added a subscriber: kde-edu. · View Herald Transcript
yurchor requested review of this revision.Oct 24 2019, 5:08 PM
aacid added a subscriber: aacid.Oct 24 2019, 6:41 PM

this is a tricky one, on one hand, yes this fixes the warning and behaves like it used to, so that's "good"

On the other hand introduces an imbalance in which the copy constructor calls normalize but the assignment operator doesn't, think that's "bad"

What do you think about actually implementing the operator= and calling normalize in it?

this is a tricky one, on one hand, yes this fixes the warning and behaves like it used to, so that's "good"

On the other hand introduces an imbalance in which the copy constructor calls normalize but the assignment operator doesn't, think that's "bad"

What do you think about actually implementing the operator= and calling normalize in it?

I might be wrong, but does the usage of normalize() in all constructors imply that it is impossible to assign "unnormalized" Rects?

aacid added a comment.Oct 24 2019, 9:34 PM

you can then call setHeight manually after creating a Rect and it becomes unnormalized

yurchor updated this revision to Diff 68752.Oct 25 2019, 2:42 PM

Implement the operator= and calling normalize() in it

aacid accepted this revision.Oct 25 2019, 6:35 PM
This revision is now accepted and ready to land.Oct 25 2019, 6:35 PM
This revision was automatically updated to reflect the committed changes.