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>bb10
parent
637d5dd6b1
commit
6cc830f7a6
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue