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<T>(Gfx::Size<U>)` 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
This commit is contained in:
Daniel Bertalan
2024-04-20 14:08:26 +02:00
committed by Andrew Kaster
parent 291d0e5de8
commit cc92c3f551
2 changed files with 2 additions and 2 deletions

View File

@@ -23,7 +23,7 @@ public:
virtual ~CBC() = default; virtual ~CBC() = default;
template<typename... Args> template<typename... Args>
explicit constexpr CBC<T>(Args... args) explicit constexpr CBC(Args... args)
: Mode<T>(args...) : Mode<T>(args...)
{ {
} }

View File

@@ -32,7 +32,7 @@ public:
} }
template<typename U> template<typename U>
explicit constexpr Size(Size<U> const& other) requires(IsConstructible<T, U>) explicit constexpr Size(Size<U> const& other)
: m_width(other.width()) : m_width(other.width())
, m_height(other.height()) , m_height(other.height())
{ {