Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.7.8 fails to build on Windows with GCC and Clang #10730

Closed
lazka opened this issue May 11, 2024 · 5 comments · Fixed by #10847
Closed

2.7.8 fails to build on Windows with GCC and Clang #10730

lazka opened this issue May 11, 2024 · 5 comments · Fixed by #10847
Milestone

Comments

@lazka
Copy link
Contributor

lazka commented May 11, 2024

Overview

2.7.7 builds fine, 2.7.8 fails.

GCC fails with:

  In file included from D:/M/msys64/ucrt64/include/QtTest/qtest.h:45,
                   from D:/M/msys64/ucrt64/include/QtTest/QTest:1,
                   from C:/_/B/src/keepassxc-2.7.8/tests/TestDatabase.cpp:23:
  C:/_/B/src/keepassxc-2.7.8/tests/TestDatabase.cpp: In member function 'void TestDatabase::testSaveAs()':
  C:/_/B/src/keepassxc-2.7.8/tests/TestDatabase.cpp:127:34: error: cannot call constructor 'QFileInfo::QFileInfo' directly [-fpermissive]
    127 |     QVERIFY(!QFileInfo::QFileInfo(newDbFileName).isHidden());
        |              ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
  C:/_/B/src/keepassxc-2.7.8/tests/TestDatabase.cpp:127:34: note: for a function-style cast, remove the redundant '::QFileInfo'
  C:/_/B/src/keepassxc-2.7.8/tests/TestDatabase.cpp:130:33: error: cannot call constructor 'QFileInfo::QFileInfo' directly [-fpermissive]
    130 |     QVERIFY(QFileInfo::QFileInfo(newDbFileName).isHidden());
        |             ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
  C:/_/B/src/keepassxc-2.7.8/tests/TestDatabase.cpp:130:33: note: for a function-style cast, remove the redundant '::QFileInfo'

Clang fails with:

   C:/_/B/src/keepassxc-2.7.8/tests/TestDatabase.cpp:127:25: error: qualified reference to 'QFileInfo' is a constructor name rather than a type in this context
    127 |     QVERIFY(!QFileInfo::QFileInfo(newDbFileName).isHidden());
        |                         ^
  C:/_/B/src/keepassxc-2.7.8/tests/TestDatabase.cpp:130:24: error: qualified reference to 'QFileInfo' is a constructor name rather than a type in this context
  
    130 |     QVERIFY(QFileInfo::QFileInfo(newDbFileName).isHidden());
  
        |                        ^
@lazka lazka added the bug label May 11, 2024
lazka added a commit to lazka/MINGW-packages that referenced this issue May 11, 2024
Building tests fails, so disable them:
keepassxreboot/keepassxc#10730
@lazka
Copy link
Contributor Author

lazka commented May 11, 2024

We disabled building the tests downstream now, to work around this.

@droidmonkey
Copy link
Member

That's interesting, hadn't failed anywhere with our CI or even GitHub Actions.

@lazka
Copy link
Contributor Author

lazka commented May 11, 2024

This seems to be Windows only code, so maybe just a MSVC vs mingw thing (?)

@droidmonkey
Copy link
Member

droidmonkey commented May 11, 2024

Good point, I never built tests on mingw, only use it for release of the legacy windows package

@lazka
Copy link
Contributor Author

lazka commented May 11, 2024

I can confirm that this makes it work:

--- keepassxc-2.7.8/tests/TestDatabase.cpp.orig	2024-05-05 22:40:29.000000000 +0200
+++ keepassxc-2.7.8/tests/TestDatabase.cpp	2024-05-11 13:43:53.916506400 +0200
@@ -124,10 +124,10 @@
     QCOMPARE(spyFilePathChanged.count(), 1);
     QVERIFY(QFile::exists(newDbFileName));
 #ifdef Q_OS_WIN
-    QVERIFY(!QFileInfo::QFileInfo(newDbFileName).isHidden());
+    QVERIFY(!QFileInfo(newDbFileName).isHidden());
     SetFileAttributes(newDbFileName.toStdString().c_str(), FILE_ATTRIBUTE_HIDDEN);
     QVERIFY2(db->saveAs(newDbFileName, Database::Atomic, QString(), &error), error.toLatin1());
-    QVERIFY(QFileInfo::QFileInfo(newDbFileName).isHidden());
+    QVERIFY(QFileInfo(newDbFileName).isHidden());
 #endif
     QFile::remove(newDbFileName);
     QVERIFY(!QFile::exists(newDbFileName));

@droidmonkey droidmonkey added this to the v2.7.9 milestone May 27, 2024
c4rlo added a commit to c4rlo/keepassxc that referenced this issue Jun 2, 2024
Fixes keepassxreboot#10730.

I've not actually tested this, let alone on Windows, but it seems
very straightforward, and I'm going off
keepassxreboot#10730 (comment).

Co-authored-by: Christoph Reiter <[email protected]>
droidmonkey added a commit to c4rlo/keepassxc that referenced this issue Jun 2, 2024
droidmonkey added a commit to c4rlo/keepassxc that referenced this issue Jun 2, 2024
pull bot pushed a commit to tigerwill90/keepassxc that referenced this issue Jun 15, 2024
droidmonkey pushed a commit that referenced this issue Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants