diff --git a/AK/FlyString.h b/AK/FlyString.h index f6f09b2122..b750e8e246 100644 --- a/AK/FlyString.h +++ b/AK/FlyString.h @@ -21,6 +21,10 @@ public: ~FlyString(); static ErrorOr from_utf8(StringView); + template + requires(IsOneOf, DeprecatedString, DeprecatedFlyString>) + static ErrorOr from_utf8(T&&) = delete; + FlyString(String const&); FlyString& operator=(String const&); @@ -54,6 +58,9 @@ public: // FIXME: Remove these once all code has been ported to FlyString [[nodiscard]] DeprecatedFlyString to_deprecated_fly_string() const; static ErrorOr from_deprecated_fly_string(DeprecatedFlyString const&); + template + requires(IsSame, StringView>) + static ErrorOr from_deprecated_fly_string(T&&) = delete; // Compare this FlyString against another string with ASCII caseless matching. [[nodiscard]] bool equals_ignoring_ascii_case(FlyString const&) const; diff --git a/AK/String.h b/AK/String.h index 58047b4ebd..acf996661c 100644 --- a/AK/String.h +++ b/AK/String.h @@ -64,6 +64,9 @@ public: // Creates a new String from a sequence of UTF-8 encoded code points. static ErrorOr from_utf8(StringView); + template + requires(IsOneOf, DeprecatedString, DeprecatedFlyString>) + static ErrorOr from_utf8(T&&) = delete; // Creates a new String by reading byte_count bytes from a UTF-8 encoded Stream. static ErrorOr from_stream(Stream&, size_t byte_count); @@ -225,6 +228,9 @@ public: // FIXME: Remove these once all code has been ported to String [[nodiscard]] DeprecatedString to_deprecated_string() const; static ErrorOr from_deprecated_string(DeprecatedString const&); + template + requires(IsSame, StringView>) + static ErrorOr from_deprecated_string(T&&) = delete; private: // NOTE: If the least significant bit of the pointer is set, this is a short string. diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index 193d0754a7..8feb4ec4c1 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -1047,7 +1047,7 @@ ErrorOr mkdtemp(Span pattern) return Error::from_errno(errno); } - return String::from_utf8({ path, strlen(path) }); + return String::from_utf8(StringView { path, strlen(path) }); } ErrorOr rename(StringView old_path, StringView new_path)