Try
FPS = to_string(int(1.f / *dt))
Even if that's not the solution it always helps to be explicit with your constant types (1, 1u, 1ul, 1.f, 1.0 etc...) to be better sure than implicit conversions like this.
As a side note it's not really necessary to pass dt as a pointer, when passing by value will do, if only because it'll be copying a smaller 32bit float float instead of a 64bit pointer ;) Here is an interesting discussion on the topic: https://stackoverflow.com/questions/270408/is-it-better-in-c-to-pass-by-value-or-pass-by-constant-reference and one, for when you do pass by reference, on const correctness: https://isocpp.org/wiki/faq/const-correctness
This is not a bug in SFML, because I'm certain you won't be able to reproduce this in a minimal example such as the following code:
#include <SFML/Graphics.hpp>
#include <string>
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
sf::Font font;
if (!font.loadFromFile("arial.ttf"))
{
return -1;
}
sf::Text text("100", font, 50);
sf::Clock clock;
while (window.isOpen())
{
auto dt = clock.restart();
for (auto event = sf::Event{}; window.pollEvent(event);)
{
if (event.type == sf::Event::Closed)
{
window.close();
}
}
text.setString(std::to_string(1.f / dt.asSeconds()));
window.clear();
window.draw(text);
window.display();
}
}
There's probably something odd going on with either the way you handle the font or text object, or you have somewhere a hidden setString that you forgot about.
I suggest to run things through a debugger and go step by step.