Skip to content

Commit 487e3e0

Browse files
Fixing issues reported by code checker
- Adjusting according to modernize-use-default-member-init policy. - fixing also a logic error in the comparison operator
1 parent 3067d9c commit 487e3e0

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Framework/Core/test/TestClasses.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace test
2020
class TriviallyCopyable
2121
{
2222
public:
23-
TriviallyCopyable() : mX(0), mY(0), mSecret(~((decltype(mSecret))0)) {};
23+
TriviallyCopyable() = default;
2424
TriviallyCopyable(unsigned x, unsigned y, unsigned secret)
2525
: mX(x)
2626
, mY(y)
@@ -30,35 +30,35 @@ class TriviallyCopyable
3030

3131
bool operator==(const TriviallyCopyable& rhs) const
3232
{
33-
return mX == rhs.mX || mY == rhs.mY || mSecret == rhs.mSecret;
33+
return mX == rhs.mX && mY == rhs.mY && mSecret == rhs.mSecret;
3434
}
3535

36-
unsigned mX;
37-
unsigned mY;
36+
unsigned mX = 0;
37+
unsigned mY = 0;
3838

3939
private:
40-
unsigned mSecret;
40+
unsigned mSecret = ~((decltype(mSecret))0);
4141

4242
ClassDefNV(TriviallyCopyable, 1);
4343
};
4444

4545
class Base
4646
{
4747
public:
48-
Base() : mMember(0) {}
49-
virtual ~Base() {}
48+
Base() = default;
49+
virtual ~Base() = default;
5050
virtual void f() {}
5151

5252
private:
53-
int mMember;
53+
int mMember = 0;
5454

5555
ClassDef(Base, 1);
5656
};
5757

5858
class Polymorphic : public Base
5959
{
6060
public:
61-
Polymorphic() : mSecret(~((decltype(mSecret))0)) {}
61+
Polymorphic() = default;
6262
Polymorphic(unsigned secret) : mSecret(secret) {}
6363

6464
bool operator==(const Polymorphic& rhs) const { return mSecret == rhs.mSecret; }
@@ -68,7 +68,7 @@ class Polymorphic : public Base
6868
unsigned get() const { return mSecret; }
6969

7070
private:
71-
unsigned mSecret;
71+
unsigned mSecret = ~((decltype(mSecret))0);
7272

7373
ClassDefOverride(Polymorphic, 1);
7474
};

0 commit comments

Comments
 (0)