tst_qpromise: build fix
The test use aggregate initialization on some classes which however are no longer aggregates in C++20 (the rules changed again; in C++20 having a user-*declared* constructor makes a class not an aggregate). Just add a constructor so the code keeps compiling in both 17 and 20. Fixes: QTBUG-92963 Change-Id: I52371c5ee34c84358987b5ae8bee9ab9c49c8eab Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 7cdf77f5e781edb891bcef1c3cf041e2b5519e2b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
83dbe0af20
commit
ac55ee919a
@ -78,21 +78,21 @@ private slots:
|
|||||||
struct TrivialType { int field = 0; };
|
struct TrivialType { int field = 0; };
|
||||||
struct CopyOnlyType {
|
struct CopyOnlyType {
|
||||||
Q_DISABLE_MOVE(CopyOnlyType)
|
Q_DISABLE_MOVE(CopyOnlyType)
|
||||||
CopyOnlyType() = default;
|
constexpr CopyOnlyType(int field = 0) noexcept : field(field) {}
|
||||||
CopyOnlyType(const CopyOnlyType &) = default;
|
CopyOnlyType(const CopyOnlyType &) = default;
|
||||||
CopyOnlyType& operator=(const CopyOnlyType &) = default;
|
CopyOnlyType& operator=(const CopyOnlyType &) = default;
|
||||||
~CopyOnlyType() = default;
|
~CopyOnlyType() = default;
|
||||||
|
|
||||||
int field = 0;
|
int field;
|
||||||
};
|
};
|
||||||
struct MoveOnlyType {
|
struct MoveOnlyType {
|
||||||
Q_DISABLE_COPY(MoveOnlyType)
|
Q_DISABLE_COPY(MoveOnlyType)
|
||||||
MoveOnlyType() = default;
|
constexpr MoveOnlyType(int field = 0) noexcept : field(field) {}
|
||||||
MoveOnlyType(MoveOnlyType &&) = default;
|
MoveOnlyType(MoveOnlyType &&) = default;
|
||||||
MoveOnlyType& operator=(MoveOnlyType &&) = default;
|
MoveOnlyType& operator=(MoveOnlyType &&) = default;
|
||||||
~MoveOnlyType() = default;
|
~MoveOnlyType() = default;
|
||||||
|
|
||||||
int field = 0;
|
int field;
|
||||||
};
|
};
|
||||||
bool operator==(const CopyOnlyType &a, const CopyOnlyType &b) { return a.field == b.field; }
|
bool operator==(const CopyOnlyType &a, const CopyOnlyType &b) { return a.field == b.field; }
|
||||||
bool operator==(const MoveOnlyType &a, const MoveOnlyType &b) { return a.field == b.field; }
|
bool operator==(const MoveOnlyType &a, const MoveOnlyType &b) { return a.field == b.field; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user