Bug 469428 - Compiler error on Clang 16: core/backends/bluetooth/bluetoothdevicelink.cpp:102:12: error: chosen constructor is explicit in copy-initialization
Summary: Compiler error on Clang 16: core/backends/bluetooth/bluetoothdevicelink.cpp:1...
Status: RESOLVED FIXED
Alias: None
Product: kdeconnect
Classification: Applications
Component: common (show other bugs)
Version: 23.04.0
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Albert Vaca Cintora
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-06 19:41 UTC by Ali Abdel-Qader
Modified: 2023-06-08 20:00 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ali Abdel-Qader 2023-05-06 19:41:51 UTC
Clang 16 has the following build error.

../kdeconnect-9999/core/backends/bluetooth/bluetoothdevicelink.cpp:102:12: error: chosen constructor is explicit in copy-initialization
    return {}; // TODO Not sure what to do here. For LanDeviceLink we use the SSL connection's certificate, but we don't have that here
           ^~
/usr/include/qt5/QtNetwork/qsslcertificate.h:95:14: note: explicit constructor declared here
    explicit QSslCertificate(const QByteArray &data = QByteArray(), QSsl::EncodingFormat format = QSsl::Pem);
             ^
1 error generated.
Comment 1 Bug Janitor Service 2023-05-06 20:01:24 UTC
A possibly relevant merge request was started @ https://invent.kde.org/network/kdeconnect-kde/-/merge_requests/540
Comment 2 Ali Abdel-Qader 2023-05-08 13:33:33 UTC
Git commit bbac0aa0852b14bc5cc9a1b8c3be0f55adda2428 by Ali Abdel-Qader.
Committed on 06/05/2023 at 19:51.
Pushed by albertvaka into branch 'master'.

Use explicit constructor for QSslCertificate with value initialized
argument

Previously the BluetoothDeviceLink::certificate() method was returning a
value initialized object which I believe default initializes the object.
However, Clang throws a build error at this because QSslCertificate has
explicit constructors. This change uses one of those constructors and
uses value intialization to default construct/initialize the argument
for it. It fixes the build and hopefully doesn't break anything since
this is a TODO anyways!

Signed-off-by: Ali Abdel-Qader <abdelqaderali@protonmail.com>

M  +1    -1    core/backends/bluetooth/bluetoothdevicelink.cpp

https://invent.kde.org/network/kdeconnect-kde/commit/bbac0aa0852b14bc5cc9a1b8c3be0f55adda2428
Comment 3 Andreas Sturmlechner 2023-06-08 20:00:50 UTC
Git commit 8687f8cfdaf689aea5fb2cdb8043c5c4d5a93658 by Andreas Sturmlechner, on behalf of Ali Abdel-Qader.
Committed on 08/06/2023 at 07:16.
Pushed by albertvaka into branch 'release/23.04'.

Use explicit constructor for QSslCertificate with value initialized argument

Previously the BluetoothDeviceLink::certificate() method was returning a
value initialized object which I believe default initializes the object.
However, Clang throws a build error at this because QSslCertificate has
explicit constructors. This change uses one of those constructors and
uses value intialization to default construct/initialize the argument
for it. It fixes the build and hopefully doesn't break anything since
this is a TODO anyways!

Signed-off-by: Ali Abdel-Qader <abdelqaderali@protonmail.com>
(cherry picked from commit bbac0aa0852b14bc5cc9a1b8c3be0f55adda2428)

M  +1    -1    core/backends/bluetooth/bluetoothdevicelink.cpp

https://invent.kde.org/network/kdeconnect-kde/-/commit/8687f8cfdaf689aea5fb2cdb8043c5c4d5a93658