summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/global
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-06-01 07:50:46 +0200
committerUlf Hermann <ulf.hermann@qt.io>2022-06-02 14:02:44 +0200
commita248d8daf5d12795c2891c3ac8978b1f728e43e8 (patch)
tree1f70e9388b0e3a792442b5bcc0c133d778401a21 /tests/auto/corelib/global
parentb9cce12e76796962e5e5ad0d5408370af56af459 (diff)
Endian: Allow special bitfield union fields to cover the whole storage
This requires a different computation of the mask since we can't shift out of the storage type. Change-Id: Ife85ca3e0c5ca47f06988a397cc2f8a7e28ad0fe Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/global')
-rw-r--r--tests/auto/corelib/global/qtendian/tst_qtendian.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/auto/corelib/global/qtendian/tst_qtendian.cpp b/tests/auto/corelib/global/qtendian/tst_qtendian.cpp
index 7f13559067..e688768b74 100644
--- a/tests/auto/corelib/global/qtendian/tst_qtendian.cpp
+++ b/tests/auto/corelib/global/qtendian/tst_qtendian.cpp
@@ -377,8 +377,9 @@ void testBitfieldUnion()
using upper = Member<21, 11, uint>;
using lower = Member<10, 11, uint>;
using bottom = Member<0, 10, int>;
+ using all = Member<0, 32, uint>;
- using UnionType = Union<upper, lower, bottom>;
+ using UnionType = Union<upper, lower, bottom, all>;
UnionType u;
u.template set<upper>(200);
@@ -402,6 +403,15 @@ void testBitfieldUnion()
UnionType u2(QSpecialIntegerBitfieldZero);
QCOMPARE(u2.data(), 0U);
+ u2.template set<all>(std::numeric_limits<uint>::max());
+ QCOMPARE(u2.template get<all>(), std::numeric_limits<uint>::max());
+
+ u2.template set<all>(453);
+ QCOMPARE(u2.template get<all>(), 453U);
+
+ u2.template set<all>(0);
+ QCOMPARE(u2.template get<all>(), 0U);
+
UnionType u3(42U);
QCOMPARE(u3.data(), 42U);