summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2021-07-09 14:25:36 +0200
committerMarc Mutz <marc.mutz@kdab.com>2021-07-09 17:59:01 +0200
commit6cc830f7a66684c2193a70ec9446ba4a6972dc63 (patch)
tree743fe9f3560c073d8636b881f5bf1ba5325f36aa /tests/auto/corelib
parent637d5dd6b1f3a6974c3447042d48c71ef0bd695a (diff)
tst_QFile: fix GCC -Wignored-qualifiers
The decltype() of a const auto variable will be const T, for some T. GCC warns that in the static_cast, said const is ignored. Fix by not casting, but declaring a variable of fitting type. Add a scope so the next reader doesn't have to go hunting for further uses of 'readResult' or, now, 'expected'. Change-Id: Iebc828a522810c6f2514fb3542d8c76c755ec7a5 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/io/qfile/tst_qfile.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp
index c67579967b..83a706e81d 100644
--- a/tests/auto/corelib/io/qfile/tst_qfile.cpp
+++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp
@@ -2899,8 +2899,11 @@ void tst_QFile::handle()
QVERIFY(fd > 2);
QCOMPARE(int(file.handle()), fd);
char c = '\0';
- const auto readResult = QT_READ(int(file.handle()), &c, 1);
- QCOMPARE(readResult, static_cast<decltype(readResult)>(1));
+ {
+ const auto readResult = QT_READ(int(file.handle()), &c, 1);
+ decltype(readResult) expected = 1;
+ QCOMPARE(readResult, expected);
+ }
QCOMPARE(c, '/');
// test if the QFile and the handle remain in sync