diff --git a/include/SFML/Graphics/Text.hpp b/include/SFML/Graphics/Text.hpp index c1b4dba5..f9153090 100644 --- a/include/SFML/Graphics/Text.hpp +++ b/include/SFML/Graphics/Text.hpp @@ -88,6 +88,12 @@ public: //////////////////////////////////////////////////////////// Text(const String& string, const Font& font, unsigned int characterSize = 30); + //////////////////////////////////////////////////////////// + /// \brief Disallow construction from a temporary font + /// + //////////////////////////////////////////////////////////// + Text(const String& string, Font&& font, unsigned int characterSize = 30) = delete; + //////////////////////////////////////////////////////////// /// \brief Copy constructor /// @@ -150,6 +156,12 @@ public: //////////////////////////////////////////////////////////// void setFont(const Font& font); + //////////////////////////////////////////////////////////// + /// \brief Disallow setting from a temporary font + /// + //////////////////////////////////////////////////////////// + void setFont(Font&& font) = delete; + //////////////////////////////////////////////////////////// /// \brief Set the character size /// diff --git a/test/Graphics/Text.test.cpp b/test/Graphics/Text.test.cpp index 9cf10197..bdc2ccdd 100644 --- a/test/Graphics/Text.test.cpp +++ b/test/Graphics/Text.test.cpp @@ -2,6 +2,7 @@ #include +static_assert(!std::is_constructible_v); static_assert(std::is_copy_constructible_v); static_assert(std::is_copy_assignable_v); static_assert(std::is_nothrow_move_constructible_v);