From cc92c3f5518d3d6effaa45d33ed661dcc5fb351f Mon Sep 17 00:00:00 2001 From: Daniel Bertalan Date: Sat, 20 Apr 2024 14:08:26 +0200 Subject: [PATCH] LibCrypto+LibGfx: Fix GCC 14 compile errors The C++ standard does not allow specifying the template parameters in constructor declarations, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97202#c8. Converting constructors have a higher priority that user-defined conversion functions; let's constrain `Gfx::Size(Gfx::Size)` to only be considered when `U` is convertible to `T`. This lets us fall back to conversion operators in the case of `UISize` -> `IntSize`, for instance. Clang is still okay without this, but MSVC would error out similarly: https://godbolt.org/z/PTbeYPM7s Note that a not-yet-committed patch is required for full compilation: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114784#c3 --- Userland/Libraries/LibCrypto/Cipher/Mode/CBC.h | 2 +- Userland/Libraries/LibGfx/Size.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibCrypto/Cipher/Mode/CBC.h b/Userland/Libraries/LibCrypto/Cipher/Mode/CBC.h index 777121a4dba..00c97495a9f 100644 --- a/Userland/Libraries/LibCrypto/Cipher/Mode/CBC.h +++ b/Userland/Libraries/LibCrypto/Cipher/Mode/CBC.h @@ -23,7 +23,7 @@ public: virtual ~CBC() = default; template - explicit constexpr CBC(Args... args) + explicit constexpr CBC(Args... args) : Mode(args...) { } diff --git a/Userland/Libraries/LibGfx/Size.h b/Userland/Libraries/LibGfx/Size.h index 11be3728c7e..69be4f6309c 100644 --- a/Userland/Libraries/LibGfx/Size.h +++ b/Userland/Libraries/LibGfx/Size.h @@ -32,7 +32,7 @@ public: } template - explicit constexpr Size(Size const& other) + requires(IsConstructible) explicit constexpr Size(Size const& other) : m_width(other.width()) , m_height(other.height()) {